Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/commandsgen/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (w *docWriter) writeCommand(c *Command) {
w.fileMap[fileName].WriteString("title: Temporal CLI " + fileName + " command reference\n")
w.fileMap[fileName].WriteString("sidebar_label: " + fileName + "\n")
w.fileMap[fileName].WriteString("description: " + c.Docs.DescriptionHeader + "\n")
w.fileMap[fileName].WriteString("toc_max_heading_level: 4\n")
w.fileMap[fileName].WriteString("toc_max_heading_level: 6\n")

w.fileMap[fileName].WriteString("keywords:\n")
for _, keyword := range c.Docs.Keywords {
Expand Down Expand Up @@ -217,7 +217,7 @@ func (w *docWriter) writeSplitCommand(c *Command, splitRoot string) {
buf.WriteString("title: Temporal CLI " + c.FullName + " command reference\n")
buf.WriteString("sidebar_label: " + leafName + "\n")
buf.WriteString("description: " + c.Docs.DescriptionHeader + "\n")
buf.WriteString("toc_max_heading_level: 4\n")
buf.WriteString("toc_max_heading_level: 6\n")
buf.WriteString("keywords:\n")
for _, keyword := range c.Docs.Keywords {
buf.WriteString(" - " + keyword + "\n")
Expand Down
329 changes: 329 additions & 0 deletions internal/temporalcli/commands.gen.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package temporalcli

import (
"fmt"

computepb "go.temporal.io/api/compute/v1"
"go.temporal.io/sdk/converter"
)

func (c *TemporalWorkerDeploymentVersionComputeConfigAwsLambdaCreateCommand) run(cctx *CommandContext, args []string) error {
provider, err := awsLambdaProvider(c.FunctionArn, &c.AwsAssumeRoleOptions)
if err != nil {
return err
}
scalerDetails, err := c.NoSyncScalerOptions.details()
if err != nil {
return err
}
sg, err := noSyncScalingGroup(&c.ScalingGroupOptions, provider, scalerDetails)
if err != nil {
return err
}
return createVersionWithScalingGroup(cctx, c.Parent.Parent.Parent.Parent.Parent, c.deploymentVersion(), c.ScalingGroup, sg, "aws-lambda")
}

func (c *TemporalWorkerDeploymentVersionComputeConfigAwsLambdaUpdateCommand) run(cctx *CommandContext, args []string) error {
provider, err := c.provider()
if err != nil {
return err
}
scalerDetails, err := c.NoSyncScalerOptions.details()
if err != nil {
return err
}
update, err := noSyncScalingGroupUpdate(&c.ScalingGroupOptions, provider, scalerDetails)
if err != nil {
return err
}
return updateVersionScalingGroup(cctx, c.Parent.Parent.Parent.Parent.Parent, c.deploymentVersion(), c.ScalingGroup, update, "aws-lambda")
}

// provider returns the AWS Lambda provider to set, or nil to leave it unchanged.
// The provider flags are all or nothing, because the provider's details are
// replaced as a whole.
func (c *TemporalWorkerDeploymentVersionComputeConfigAwsLambdaUpdateCommand) provider() (*computepb.ComputeProvider, error) {
functionArnSet := c.Command.Flags().Changed("function-arn")
if !functionArnSet && !c.AwsAssumeRoleOptions.passed() {
return nil, nil
}
if !functionArnSet {
return nil, fmt.Errorf("--function-arn is required when changing the provider")
}
return awsLambdaProvider(c.FunctionArn, &c.AwsAssumeRoleOptions)
}

// The AWS Lambda compute provider.
const awsLambdaProviderType = "aws-lambda"

// awsLambdaProvider builds the AWS Lambda compute provider from the provider
// flags. Provider config keys:
// https://github.com/temporalio/temporal-auto-scaled-workers/blob/main/wci/workflow/compute_provider/aws_lambda.go
func awsLambdaProvider(functionArn string, role *AwsAssumeRoleOptions) (*computepb.ComputeProvider, error) {
if functionArn == "" {
return nil, fmt.Errorf("--function-arn cannot be empty")
}
details := map[string]any{"arn": functionArn}
if err := role.setDetails(details); err != nil {
return nil, err
}
payload, err := converter.GetDefaultDataConverter().ToPayload(details)
if err != nil {
return nil, err
}
return &computepb.ComputeProvider{Type: awsLambdaProviderType, Details: payload}, nil
}
Loading
Loading