model

package
v0.0.0-...-b5fafc8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASGModel

type ASGModel struct {
	autoscalingiface.AutoScalingAPI
}

ASGModel is a struct including the AWS SDK ASG interface, all ASG model functions are called on this struct and the included AWS SDK ASG service

func NewASGModel

func NewASGModel(svc autoscalingiface.AutoScalingAPI) *ASGModel

NewASGModel takes the AWS SDK ASG Interface as parameter and returns the pointer to an ASGModel struct, on which all ASG model functions can be called

func (*ASGModel) DescribeAutoScalingGroupForTagsAndAction

func (asgModel *ASGModel) DescribeAutoScalingGroupForTagsAndAction(repository, branch, action string) (*string, error)

DescribeAutoScalingGroupForTagsAndAction gets the name of the autoscaling group matching the repository and branch name (the autoscaling group gets found by tags). Additionally the function checks if an action is required based on the current min size and only then returns the name. If an error occurs, it gets logged and then returned.

func (*ASGModel) GetPreviousMinValueOfASG

func (asgModel *ASGModel) GetPreviousMinValueOfASG(asgName *string) (int, error)

GetPreviousMinValueOfASG returns the previous min value for the autoscaling group matching the given name. The previous min value is determined by a tag attached to the autoscaling group, the tag has the key "minSize" and the previous min size as value (example = 2). If an error occurs, it gets logged and then 0 plus the error will be returned.

func (*ASGModel) SetASGMinToPreviousValue

func (asgModel *ASGModel) SetASGMinToPreviousValue(asgName *string) error

SetASGMinToPreviousValue sets the min size for the autoscaling group matching the given name to its previous value received from the GetPreviousMinValueOfASG function. If an error occurs, it gets logged and then returned.

func (*ASGModel) SetASGMinToZero

func (asgModel *ASGModel) SetASGMinToZero(asgName *string) error

SetASGMinToZero sets the min size for the autoscaling group matching the given name to 0. If an error occurs, it gets logged and then returned.

type ASGModelAPI

type ASGModelAPI interface {
	DescribeAutoScalingGroupForTagsAndAction(repository, branch, action string) (*string, error)
	SetASGMinToPreviousValue(asgName *string) error
	SetASGMinToZero(asgName *string) error
	GetPreviousMinValueOfASG(asgName *string) (int, error)
}

ASGModelAPI is an interface including all ASG model functions

type EC2Model

type EC2Model struct {
	ec2iface.EC2API
}

EC2Model is a struct including the AWS SDK EC2 interface, all EC2 model functions are called on this struct and the included AWS SDK EC2 service

func NewEC2Model

func NewEC2Model(svc ec2iface.EC2API) *EC2Model

NewEC2Model takes the AWS SDK EC2 Interface as parameter and returns the pointer to an EC2Model struct, on which all EC2 model functions can be called

func (*EC2Model) DescribeInstancesForTagsAndAction

func (ec2Model *EC2Model) DescribeInstancesForTagsAndAction(repository, branch, action string) ([]*string, error)

DescribeInstancesForTagsAndAction takes a repository name, a branch name and an action (which can be "start" or "stop"). The function filters all EC2 Instances by repository and branch_raw tag and then writes all instanceIDs of instances to the *string array, which must get adapted based on the given action. If an error occurs, it gets logged and then returned

func (*EC2Model) StartEC2Instances

func (ec2Model *EC2Model) StartEC2Instances(instanceIDs []*string) error

StartEC2Instances starts all EC2 instances given in the instanceIDs array by using the AWS SDK. If an error occurs, it gets logged and then returned

func (*EC2Model) StopEC2Instances

func (ec2Model *EC2Model) StopEC2Instances(instanceIDs []*string) error

StopEC2Instances stops all EC2 instances given in the instanceIDs array by using the AWS SDK. If an error occurs, it gets logged and then returned

type EC2ModelAPI

type EC2ModelAPI interface {
	DescribeInstancesForTagsAndAction(repository, branch, action string) ([]*string, error)
	StartEC2Instances(instanceIDs []*string) error
	StopEC2Instances(instanceIDs []*string) error
}

EC2ModelAPI is an interface including all EC2 model functions

type RDSModel

type RDSModel struct {
	rdsiface.RDSAPI
}

RDSModel is a struct including the AWS SDK RDS interface, all RDS model functions are called on this struct and the included AWS SDK RDS service

func NewRDSModel

func NewRDSModel(svc rdsiface.RDSAPI) *RDSModel

NewRDSModel takes the AWS SDK RDS Interface as parameter and returns the pointer to an RDSModel struct, on which all RDS model functions can be called

func (*RDSModel) GetRDSClusterForTags

func (rdsmodel *RDSModel) GetRDSClusterForTags(repository, branch string) (*string, *string, error)

GetRDSClusterForTags returns the ARN and the status of the Cluster found for the given repository and branch tag values. If an error occurs, the error gets logged and then returned.

func (*RDSModel) StartRDSCluster

func (rdsmodel *RDSModel) StartRDSCluster(clusterARN, clusterStatus *string) (bool, error)

StartRDSCluster starts the RDS Cluster for the given Cluster ARN and status. It returns true, if the state of the Cluster was changed and false if not. If an error occurs, the error gets logged and then returned.

func (*RDSModel) StopRDSCluster

func (rdsmodel *RDSModel) StopRDSCluster(clusterARN, clusterStatus *string) (bool, error)

StopRDSCluster stops the RDS Cluster for the given Cluster ARN and status. It returns true, if the state of the Cluster was changed and false if not. If an error occurs, the error gets logged and then returned.

type RDSModelAPI

type RDSModelAPI interface {
	GetRDSClusterForTags(repository, branch string) (*string, *string, error)
	StopRDSCluster(clusterARN, clusterStatus *string) (bool, error)
	StartRDSCluster(clusterARN, clusterStatus *string) (bool, error)
}

RDSModelAPI is an interface including all RDS model functions

type StatusModel

type StatusModel struct {
	dynamodbiface.DynamoDBAPI
}

StatusModel is a struct including the AWS SDK DynamoDB interface, all status change functions are called on this struct and the included AWS SDK DynamoDB service

func NewStatusModel

func NewStatusModel(svc dynamodbiface.DynamoDBAPI) *StatusModel

NewStatusModel takes the AWS SDK DynamoDB Interface as parameter and returns the pointer to an StatusModel struct, on which status change model functions can be called

func (*StatusModel) SetStatusForEnvironment

func (statusModel *StatusModel) SetStatusForEnvironment(repository, branch, status string) error

SetStatusForEnvironment updates the status for the Environment given in the parameters to the status given in the parameters. If an error occurs the error gets logged and the returned.

type StatusModelAPI

type StatusModelAPI interface {
	SetStatusForEnvironment(repository, branch, status string) error
}

StatusModelAPI is an interface including all Status model functions

Jump to

Keyboard shortcuts

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