Skip to content

Commit

Permalink
Add region to aws.ecs.cluster + improve defaults (#2862)
Browse files Browse the repository at this point in the history
Also use StringDataPtr where we can

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Dec 19, 2023
1 parent 15f03f6 commit 931a38c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ aws.ecs {
}

// Amazon ECS cluster
private aws.ecs.cluster {
private aws.ecs.cluster @defaults("name region status runningTasksCount pendingTasksCount") {
// ARN of the ECS cluster
arn string
// Name of the ECS cluster
Expand All @@ -1193,6 +1193,8 @@ private aws.ecs.cluster {
tasks() []aws.ecs.task
// List of AWS ECS container instances
containerInstances() []aws.ecs.instance
// The region where the cluster is located
region string
}

// AWS ECS container instance
Expand Down
12 changes: 12 additions & 0 deletions providers/aws/resources/aws.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions providers/aws/resources/aws.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,7 @@ resources:
containerInstances: {}
name: {}
pendingTasksCount: {}
region: {}
registeredContainerInstancesCount: {}
runningTasksCount: {}
status: {}
Expand Down
5 changes: 3 additions & 2 deletions providers/aws/resources/aws_ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,14 @@ func initAwsEcsCluster(runtime *plugin.Runtime, args map[string]*llx.RawData) (m
if err != nil {
return nil, nil, err
}
args["name"] = llx.StringData(convert.ToString(c.ClusterName))
args["name"] = llx.StringDataPtr(c.ClusterName)
args["tags"] = llx.MapData(ecsTags(c.Tags), types.String)
args["runningTasksCount"] = llx.IntData(int64(c.RunningTasksCount))
args["pendingTasksCount"] = llx.IntData(int64(c.PendingTasksCount))
args["registeredContainerInstancesCount"] = llx.IntData(int64(c.RegisteredContainerInstancesCount))
args["configuration"] = llx.MapData(configuration, types.String)
args["status"] = llx.StringData(convert.ToString(c.Status))
args["status"] = llx.StringDataPtr(c.Status)
args["region"] = llx.StringData(region)
return args, nil, nil
}

Expand Down

0 comments on commit 931a38c

Please sign in to comment.