-
Notifications
You must be signed in to change notification settings - Fork 394
/
task.go
62 lines (49 loc) · 1.6 KB
/
task.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package deploy holds the structures to deploy infrastructure resources.
// This file defines service deployment resources.
package deploy
import (
"fmt"
"strings"
)
// FmtTaskECRRepoName is the pattern used to generate the ECR repository's name
const FmtTaskECRRepoName = "copilot-%s"
// CreateTaskResourcesInput holds the fields required to create a task stack.
type CreateTaskResourcesInput struct {
Name string
CPU int
Memory int
Image string
PermissionsBoundary string
TaskRole string
ExecutionRole string
Command []string
EntryPoint []string
EnvVars map[string]string
EnvFileARN string
SSMParamSecrets map[string]string
SecretsManagerSecrets map[string]string
OS string
Arch string
App string
Env string
AdditionalTags map[string]string
}
// TaskStackInfo contains essential information about a Copilot task stack
type TaskStackInfo struct {
StackName string
App string
Env string
RoleARN string
BucketName string
}
// TaskName returns the name of the one-off task. This is the same as the value of the
// copilot-task tag. For example, a stack called "task-db-migrate" will have the TaskName "db-migrate"
func (t TaskStackInfo) TaskName() string {
return strings.SplitN(t.StackName, "-", 2)[1]
}
// ECRRepoName returns the name of the ECR repo for the one-off task.
func (t TaskStackInfo) ECRRepoName() string {
return fmt.Sprintf(FmtTaskECRRepoName, t.TaskName())
}