service

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDeployDefaults added in v0.0.39

func SetDeployDefaults(d *Deploy)

Types

type Autoscaling added in v0.0.39

type Autoscaling struct {
	MinimumCount int64               `json:"minimumCount" yaml:"minimumCount"`
	DesiredCount int64               `json:"desiredCount" yaml:"desiredCount"`
	MaximumCount int64               `json:"maximumCount" yaml:"maximumCount"`
	Policies     []AutoscalingPolicy `json:"policies" yaml:"policies"`
}

create Autoscaling Policy

type AutoscalingPolicy added in v0.0.39

type AutoscalingPolicy struct {
	PolicyName           string  `json:"policyName" yaml:"policyName"`
	ComparisonOperator   string  `json:"comparisonOperator" yaml:"comparisonOperator"`
	Metric               string  `json:"metric" yaml:"metric"`
	NewAutoscalingPolicy bool    `json:"newAutoscalingPolicy" yaml:"newAutoscalingPolicy"`
	Threshold            float64 `json:"threshold" yaml:"threshold"`
	ScalingAdjustment    int64   `json:"scalingAdjustment" yaml:"scalingAdjustment"`
	ThresholdStatistic   string  `json:"thresholdStatistic" yaml:"thresholdStatistic"`
	DatapointsToAlarm    int64   `json:"datapointsToAlarm" yaml:"datapointsToAlarm"`
	EvaluationPeriods    int64   `json:"evaluationPeriods" yaml:"evaluationPeriods"`
	Period               int64   `json:"period" yaml:"period"`
}

type Deploy

type Deploy struct {
	Cluster               string                      `json:"cluster" yaml:"cluster" binding:"required"`
	LoadBalancer          string                      `json:"loadBalancer" yaml:"loadBalancer"`
	ServiceName           string                      `json:"serviceName" yaml:"serviceName"`
	ServicePort           int64                       `json:"servicePort" yaml:"servicePort"`
	ServiceProtocol       string                      `json:"serviceProtocol" yaml:"serviceProtocol" binding:"required"`
	DesiredCount          int64                       `json:"desiredCount" yaml:"desiredCount" binding:"required"`
	MinimumHealthyPercent int64                       `json:"minimumHealthyPercent" yaml:"minimumHealthyPercent"`
	MaximumPercent        int64                       `json:"maximumPercent" yaml:"maximumPercent"`
	Containers            []*DeployContainer          `json:"containers" yaml:"containers" binding:"required,dive"`
	HealthCheck           DeployHealthCheck           `json:"healthCheck" yaml:"healthCheck"`
	RuleConditions        []*DeployRuleConditions     `json:"ruleConditions" yaml:"ruleConditions"`
	NetworkMode           string                      `json:"networkMode" yaml:"networkMode"`
	NetworkConfiguration  DeployNetworkConfiguration  `json:"networkConfiguration" yaml:"networkConfiguration"`
	PlacementConstraints  []DeployPlacementConstraint `json:"placementConstraints" yaml:"placementConstraints"`
	LaunchType            string                      `json:"launchType" yaml:"launchType"`
	DeregistrationDelay   int64                       `json:"deregistrationDelay" yaml:"deregistrationDelay"`
	Stickiness            DeployStickiness            `json:"stickiness" yaml:"stickiness"`
	Volumes               []DeployVolume              `json:"volumes" yaml:"volumes"`
	EnvNamespace          string                      `json:"envNamespace" yaml:"envNamespace"`
	ServiceRegistry       string                      `json:"serviceRegistry" yaml:"serviceRegistry"`
	SchedulingStrategy    string                      `json:"schedulingStrategy" yaml:"schedulingStrategy"`
	AppMesh               DeployAppMesh               `json:"appMesh" yaml:"appMesh"`
}

type DeployAppMesh added in v0.0.39

type DeployAppMesh struct {
	Name          string                     `json:"name" yaml:"name"`
	Backends      []string                   `json:"backends" yaml:"backends"`
	RetryPolicy   DeployAppMeshRetryPolicy   `json:"retryPolicy" yaml:"retryPolicy"`
	Configuration DeployAppMeshConfiguration `json:"configuration" yaml:"configuration"`
}

type DeployAppMeshConfiguration added in v0.0.39

type DeployAppMeshConfiguration struct {
	EgressIgnoredPorts []string `json:"egressIgnoredPorts" yaml:"egressIgnoredPorts"`
}

type DeployAppMeshRetryPolicy added in v0.0.39

type DeployAppMeshRetryPolicy struct {
	HTTPRetryEvents []string `json:"httpRetryEvents" yaml:"httpRetryEvents"`
	MaxRetries      int64    `json:"maxRetries" yaml:"maxRetries"`
	PerRetryTimeout string   `json:"perRetryTimeout" yaml:"perRetryTimeout"`
	TcpRetryEvents  []string `json:"tcpRetryEvents" yaml:"tcpRetryEvents"`
}

type DeployContainer

type DeployContainer struct {
	ContainerName       string                        `json:"containerName" yaml:"containerName" binding:"required"`
	ContainerTag        string                        `json:"containerTag" yaml:"containerTag" binding:"required"`
	ContainerPort       int64                         `json:"containerPort" yaml:"containerPort"`
	ContainerCommand    []*string                     `json:"containerCommand" yaml:"containerCommand"`
	ContainerImage      string                        `json:"containerImage" yaml:"containerImage"`
	ContainerURI        string                        `json:"containerURI" yaml:"containerURI"`
	ContainerEntryPoint []*string                     `json:"containerEntryPoint" yaml:"containerEntryPoint"`
	Essential           bool                          `json:"essential" yaml:"essential"`
	Memory              int64                         `json:"memory" yaml:"memory"`
	MemoryReservation   int64                         `json:"memoryReservation" yaml:"memoryReservation"`
	CPU                 int64                         `json:"cpu" yaml:"cpu"`
	CPUReservation      int64                         `json:"cpuReservation" yaml:"cpuReservation"`
	DockerLabels        map[string]string             `json:"dockerLabels" yaml:"dockerLabels"`
	HealthCheck         DeployContainerHealthCheck    `json:"healthCheck" yaml:"healthCheck"`
	Environment         []*DeployContainerEnvironment `json:"environment" yaml:"environment"`
	MountPoints         []*DeployContainerMountPoint  `json:"mountPoints" yaml:"mountPoints"`
	Ulimits             []*DeployContainerUlimit      `json:"ulimits" yaml:"ulimits"`
	Links               []*string                     `json:"links" yaml:"links"`
	LogConfiguration    DeployLogConfiguration        `json:"logConfiguration" yaml:"logConfiguration"`
	PortMappings        []DeployContainerPortMapping  `json:"portMappings" yaml:"portMappings"`
}

type DeployContainerEnvironment added in v0.0.39

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

type DeployContainerHealthCheck added in v0.0.39

type DeployContainerHealthCheck struct {
	Command     []*string `json:"command" yaml:"command"`
	Interval    int64     `json:"interval" yaml:"interval"`
	Timeout     int64     `json:"timeout" yaml:"timeout"`
	Retries     int64     `json:"retries" yaml:"retries"`
	StartPeriod int64     `json:"startPeriod" yaml:"startPeriod"`
}

type DeployContainerMountPoint added in v0.0.39

type DeployContainerMountPoint struct {
	ContainerPath string `json:"containerPath" yaml:"containerPath"`
	SourceVolume  string `json:"sourceVolume" yaml:"sourceVolume"`
	ReadOnly      bool   `json:"readonly" yaml:"readonly"`
}

type DeployContainerPortMapping added in v0.0.39

type DeployContainerPortMapping struct {
	Protocol      string `json:"protocol" yaml:"protocol"`
	HostPort      int64  `json:"hostPort" yaml:"hostPort"`
	ContainerPort int64  `json:"containerPort" yaml:"containerPort"`
}

type DeployContainerUlimit added in v0.0.39

type DeployContainerUlimit struct {
	Name      string `json:"name" yaml:"name"`
	SoftLimit int64  `json:"softLimit" yaml:"softLimit"`
	HardLimit int64  `json:"hardLimit" yaml:"hardLimit"`
}

type DeployHealthCheck

type DeployHealthCheck struct {
	HealthyThreshold   int64  `json:"healthyThreshold" yaml:"healthyThreshold"`
	UnhealthyThreshold int64  `json:"unhealthyThreshold" yaml:"unhealthyThreshold"`
	Path               string `json:"path" yaml:"path"`
	Port               string `json:"port" yaml:"port"`
	Protocol           string `json:"protocol" yaml:"protocol"`
	Interval           int64  `json:"interval" yaml:"interval"`
	Matcher            string `json:"matcher" yaml:"matcher"`
	Timeout            int64  `json:"timeout" yaml:"timeout"`
	GracePeriodSeconds int64  `json:"gracePeriodSeconds" yaml:"gracePeriodSeconds"`
}

type DeployLogConfiguration added in v0.0.39

type DeployLogConfiguration struct {
	LogDriver string                        `json:"logDriver" yaml:"logDriver"`
	Options   DeployLogConfigurationOptions `json:"options" yaml:"options"`
}

type DeployLogConfigurationOptions added in v0.0.39

type DeployLogConfigurationOptions struct {
	MaxSize string `json:"max-size" yaml:"max-size"`
	MaxFile string `json:"max-file" yaml:"max-file"`
}

type DeployNetworkConfiguration

type DeployNetworkConfiguration struct {
	AssignPublicIp string   `json:"assignPublicIp" yaml:"assignPublicIp"`
	SecurityGroups []string `json:"securityGroups" yaml:"securityGroups"`
	Subnets        []string `json:"subnets" yaml:"subnets"`
}

type DeployPlacementConstraint

type DeployPlacementConstraint struct {
	Expression string `json:"expression" yaml:"expression"`
	Type       string `json:"type" yaml:"type"`
}

type DeployResult

type DeployResult struct {
	ServiceName       string    `json:"serviceName" yaml:"serviceName"`
	ClusterName       string    `json:"clusterName" yaml:"clusterName"`
	TaskDefinitionArn string    `json:"taskDefinitionArn" yaml:"taskDefinitionArn"`
	Status            string    `json:"status" yaml:"status"`
	DeployError       string    `json:"deployError" yaml:"deployError"`
	DeploymentTime    time.Time `json:"deploymentTime" yaml:"deploymentTime"`
}

type DeployRuleConditions

type DeployRuleConditions struct {
	Listeners   []string                        `json:"listeners" yaml:"listeners"`
	PathPattern string                          `json:"pathPattern" yaml:"pathPattern"`
	Hostname    string                          `json:"hostname" yaml:"hostname"`
	CognitoAuth DeployRuleConditionsCognitoAuth `json:"cognitoAuth" yaml:"cognitoAuth"`
}

type DeployRuleConditionsCognitoAuth added in v0.0.39

type DeployRuleConditionsCognitoAuth struct {
	UserPoolName string `json:"userPoolName" yaml:"userPoolName"`
	ClientName   string `json:"clientName" yaml:"clientName"`
}

type DeployServiceParameter

type DeployServiceParameter struct {
	Name      string `json:"name" yaml:"name" binding:"required"`
	Value     string `json:"value" yaml:"value" binding:"required"`
	Encrypted bool   `json:"encrypted" yaml:"encrypted"`
}

type DeployServices

type DeployServices struct {
	Services []Deploy `json:"services" yaml:"services" binding:"required"`
}

deploy binding from JSON

type DeployStickiness

type DeployStickiness struct {
	Enabled  bool  `json:"enabled" yaml:"enabled"`
	Duration int64 `json:"duration" yaml:"duration"`
}

type DeployVolume added in v0.0.39

type DeployVolume struct {
	Host                      DeployVolumeHost                      `json:"host" yaml:"host"`
	DockerVolumeConfiguration DeployVolumeDockerVolumeConfiguration `json:"dockerVolumeConfiguration" yaml:"dockerVolumeConfiguration"`
	Name                      string                                `json:"name" yaml:"name"`
}

type DeployVolumeDockerVolumeConfiguration added in v0.0.39

type DeployVolumeDockerVolumeConfiguration struct {
	Scope         string            `json:"scope" yaml:"scope"`
	Autoprovision bool              `json:"autoprovision" yaml:"autoprovision"`
	Driver        string            `json:"driver" yaml:"driver"`
	DriverOpts    map[string]string `json:"driverOpts" yaml:"driverOpts"`
	Labels        map[string]string `json:"labels" yaml:"labels"`
}

type DeployVolumeHost added in v0.0.39

type DeployVolumeHost struct {
	SourcePath string `json:"sourcePath" yaml:"sourcePath"`
}

type DynamoAutoscalingPull added in v0.0.39

type DynamoAutoscalingPull struct {
	Identifier    string    `dynamo:"ServiceName,hash"`
	Time          string    `dynamo:"Time,range"`
	Lock          string    `dynamo:"L"`
	LockTimestamp time.Time `dynamo:"LT"`
}

dynamo pull struct

type DynamoCluster

type DynamoCluster struct {
	Identifier         string    `dynamo:"ServiceName,hash"`
	Time               time.Time `dynamo:"Time,range"`
	ContainerInstances []DynamoClusterContainerInstance
	ScalingOperation   DynamoClusterScalingOperation
	ExpirationTime     time.Time
	ExpirationTimeTTL  int64
}

dynamo cluster struct

type DynamoClusterContainerInstance

type DynamoClusterContainerInstance struct {
	ClusterName         string
	ContainerInstanceId string
	AvailabilityZone    string
	FreeMemory          int64
	FreeCpu             int64
	Status              string
}

type DynamoClusterScalingOperation

type DynamoClusterScalingOperation struct {
	ClusterName   string
	Action        string
	PendingAction string
}

type DynamoDeployment

type DynamoDeployment struct {
	ServiceName       string    `dynamo:"ServiceName,hash"`
	Time              time.Time `dynamo:"Time,range" index:"DayIndex,range" index:"MonthIndex,range"`
	Day               string    `index:"DayIndex,hash"`
	Month             string    `index:"MonthIndex,hash"`
	Status            string
	DeployError       string
	Tag               string
	Scaling           DynamoDeploymentScaling
	ManualTasksArns   []string
	TaskDefinitionArn *string
	DeployData        *Deploy
	Version           int64
}

type DynamoDeploymentAutoscaling added in v0.0.39

type DynamoDeploymentAutoscaling struct {
	ResourceId  string
	PolicyNames []string
}

type DynamoDeploymentScaling

type DynamoDeploymentScaling struct {
	DesiredCount int64
	Autoscaling  DynamoDeploymentAutoscaling
}

type DynamoServices

type DynamoServices struct {
	ServiceName string `dynamo:"ServiceName,hash"`
	Services    []*DynamoServicesElement
	Time        string `dynamo:"Time,range"`
	Version     int64
	ApiVersion  string
}

dynamo services struct

type DynamoServicesElement

type DynamoServicesElement struct {
	C                 string
	S                 string
	MemoryLimit       int64    `dynamo:"ML"`
	MemoryReservation int64    `dynamo:"MR"`
	CpuLimit          int64    `dynamo:"CL"`
	CpuReservation    int64    `dynamo:"CR"`
	Listeners         []string `dynamo:"L"`
}

type LoadBalancer added in v0.0.39

type LoadBalancer struct {
	Name          string
	IPAddressType string
	Scheme        string
	Type          string
}

type RunTask

type RunTask struct {
	StartedBy          string                     `json:"startedBy" yaml:"startedBy"`
	ContainerOverrides []RunTaskContainerOverride `json:"containerOverrides" yaml:"containerOverrides"`
}

"Run ad-hoc task" type

type RunTaskContainerOverride

type RunTaskContainerOverride struct {
	Name        string                        `json:"name" yaml:"name"`
	Command     []string                      `json:"command" yaml:"command"`
	Environment []*DeployContainerEnvironment `json:"environment" yaml:"environment"`
}

type RunningService

type RunningService struct {
	ServiceName  string                     `json:"serviceName" yaml:"serviceName"`
	ClusterName  string                     `json:"clusterName" yaml:"clusterName"`
	RunningCount int64                      `json:"runningCount" yaml:"runningCount"`
	PendingCount int64                      `json:"pendingCount" yaml:"pendingCount"`
	DesiredCount int64                      `json:"desiredCount" yaml:"desiredCount"`
	Status       string                     `json:"status" yaml:"status"`
	Events       []RunningServiceEvent      `json:"events" yaml:"events"`
	Deployments  []RunningServiceDeployment `json:"deployments" yaml:"deployments"`
	Tasks        []RunningTask              `json:"tasks" yaml:"tasks"`
}

type RunningServiceDeployment

type RunningServiceDeployment struct {
	Status         string    `json:"status" yaml:"status"`
	RunningCount   int64     `json:"runningCount" yaml:"runningCount"`
	PendingCount   int64     `json:"pendingCount" yaml:"pendingCount"`
	DesiredCount   int64     `json:"desiredCount" yaml:"desiredCount"`
	CreatedAt      time.Time `json:"createdAt" yaml:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt" yaml:"updatedAt"`
	TaskDefinition string    `json:"taskDefinition" yaml:"taskDefinition"`
}

type RunningServiceEvent

type RunningServiceEvent struct {
	CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
	Id        string    `json:"id" yaml:"id"`
	Message   string    `json:"message" yaml:"message"`
}

type RunningTask

type RunningTask struct {
	ContainerInstanceArn string                 `json:"containerInstanceArn" yaml:"containerInstanceArn"`
	Containers           []RunningTaskContainer `json:"containers" yaml:"containers"`
	Cpu                  string                 `json:"cpu" yaml:"cpu"`
	CreatedAt            time.Time              `json:"createdAt" yaml:"createdAt"`
	DesiredStatus        string                 `json:"desiredStatus" yaml:"desiredStatus"`
	ExecutionStoppedAt   time.Time              `json:"executionStoppedAt" yaml:"executionStoppedAt"`
	Group                string                 `json:"group" yaml:"group"`
	LastStatus           string                 `json:"lastStatus" yaml:"lastStatus"`
	LaunchType           string                 `json:"launchType" yaml:"launchType"`
	Memory               string                 `json:"memory" yaml:"memory"`
	PullStartedAt        time.Time              `json:"pullStartedAt" yaml:"pullStartedAt"`
	PullStoppedAt        time.Time              `json:"pullStoppedAt" yaml:"pullStoppedAt"`
	StartedAt            time.Time              `json:"startedAt" yaml:"startedAt"`
	StartedBy            string                 `json:"startedBy" yaml:"startedBy"`
	StoppedAt            time.Time              `json:"stoppedAt" yaml:"stoppedAt"`
	StoppedReason        string                 `json:"stoppedReason" yaml:"stoppedReason"`
	StoppingAt           time.Time              `json:"stoppingAt" yaml:"stoppingAt"`
	TaskArn              string                 `json:"taskArn" yaml:"taskArn"`
	TaskDefinitionArn    string                 `json:"taskDefinitionArn" yaml:"taskDefinitionArn"`
	Version              int64                  `json:"version" yaml:"version"`
}

type RunningTaskContainer

type RunningTaskContainer struct {
	ContainerArn string `json:"containerArn" yaml:"containerArn"`
	ExitCode     int64  `json:"exitCode" yaml:"exitCode"`
	LastStatus   string `json:"lastStatus" yaml:"lastStatus"`
	Name         string `json:"name" yaml:"name"`
	Reason       string `json:"reason" yaml:"reason"`
}

type Service

type Service struct {
	ServiceName string
	ClusterName string
	Listeners   []string
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func (*Service) AutoscalingPullAcquireLock added in v0.0.39

func (s *Service) AutoscalingPullAcquireLock(localId string) (bool, error)

func (*Service) AutoscalingPullInit added in v0.0.39

func (s *Service) AutoscalingPullInit() error

func (*Service) CreateService

func (s *Service) CreateService(dsElement *DynamoServicesElement) error

func (*Service) CreateTable

func (s *Service) CreateTable() error

func (*Service) GetApiVersion

func (s *Service) GetApiVersion() (string, error)

func (*Service) GetClusterInfo

func (s *Service) GetClusterInfo() (*DynamoCluster, error)

func (*Service) GetClusterName

func (s *Service) GetClusterName() (string, error)

func (*Service) GetDeployment

func (s *Service) GetDeployment(serviceName string, strTime string) (*DynamoDeployment, error)

func (*Service) GetDeploys

func (s *Service) GetDeploys(action string, limit int64) ([]DynamoDeployment, error)

func (*Service) GetDeploysForService

func (s *Service) GetDeploysForService(serviceName string) ([]DynamoDeployment, error)

func (*Service) GetLastDeploy

func (s *Service) GetLastDeploy() (*DynamoDeployment, error)

func (*Service) GetScalingActivity

func (s *Service) GetScalingActivity(clusterName string, startTime time.Time) (string, string, error)

func (*Service) GetServiceVersionsByTags

func (s *Service) GetServiceVersionsByTags(serviceName, imageName string, tags map[string]string) ([]ServiceVersion, error)

func (*Service) GetServices

func (s *Service) GetServices(ds *DynamoServices) error

func (*Service) InitDB added in v0.0.39

func (s *Service) InitDB(apiVersion string) error

func (*Service) IsDeployRunning added in v0.0.39

func (s *Service) IsDeployRunning() (bool, error)

func (*Service) NewDeployment

func (s *Service) NewDeployment(taskDefinitionArn *string, d *Deploy) (*DynamoDeployment, error)

func (*Service) PutClusterInfo

func (s *Service) PutClusterInfo(dc DynamoCluster, clusterName string, action string, pendingAction string) (*DynamoCluster, error)

func (*Service) ServiceExistsInDynamo added in v0.0.39

func (s *Service) ServiceExistsInDynamo() (bool, error)

func (*Service) SetApiVersion

func (s *Service) SetApiVersion(apiVersion string) error

func (*Service) SetAutoscalingProperties added in v0.0.39

func (s *Service) SetAutoscalingProperties(desiredCount int64, resourceId string, policyNames []string) error

func (*Service) SetDeploymentStatus

func (s *Service) SetDeploymentStatus(dd *DynamoDeployment, status string) error

func (*Service) SetDeploymentStatusWithReason

func (s *Service) SetDeploymentStatusWithReason(dd *DynamoDeployment, status, reason string) error

func (*Service) SetManualTasksArn

func (s *Service) SetManualTasksArn(manualTaskArn string) error

func (*Service) SetScalingProperty

func (s *Service) SetScalingProperty(desiredCount int64) error

func (*Service) UpdateServiceLimits

func (s *Service) UpdateServiceLimits(clusterName, serviceName string, cpuReservation, cpuLimit, memoryReservation, memoryLimit int64) error

func (*Service) UpdateServiceListeners added in v0.0.39

func (s *Service) UpdateServiceListeners(clusterName, serviceName string, listeners []string) error

type ServiceIf added in v0.0.39

type ServiceIf interface {
	GetClusterInfo() (*DynamoCluster, error)
	IsDeployRunning() (bool, error)
	PutClusterInfo(dc DynamoCluster, clusterName string, action string, pendingAction string) (*DynamoCluster, error)
}

Service interface (for tests)

type ServiceVersion

type ServiceVersion struct {
	ImageName  string    `json:"imageName" yaml:"imageName"`
	Tag        string    `json:"tag" yaml:"tag"`
	ImageId    string    `json:"imageId" yaml:"imageId"`
	LastDeploy time.Time `json:"lastDeploy" yaml:"lastDeploy"`
}

Jump to

Keyboard shortcuts

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