Skip to content

Commit

Permalink
Implement 'aws_ssm' connection type #26
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-przybyl-wttech committed Jan 24, 2024
1 parent 091eae3 commit 0fdc56c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/client/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c ClientManager) connection(typeName string, settings map[string]string) (
}, nil
case "aws-ssm":
return &AWSSSMConnection{
InstanceId: settings["instance_id"],
InstanceID: settings["instance_id"],
Region: settings["region"],
}, nil
}
Expand Down
10 changes: 5 additions & 5 deletions internal/client/connection_aws_ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
)

type AWSSSMConnection struct {
InstanceId string
InstanceID string
Region string
Client *ssm.Client
SessionId *string
}

func (a *AWSSSMConnection) Info() string {
return fmt.Sprintf("ssm: instance='%s', region='%s'", a.InstanceId, a.Region)
return fmt.Sprintf("ssm: instance='%s', region='%s'", a.InstanceID, a.Region)
}

func (a *AWSSSMConnection) User() string {
Expand All @@ -41,7 +41,7 @@ func (a *AWSSSMConnection) Connect() error {
}

startSessionInput := &ssm.StartSessionInput{
Target: aws.String(a.InstanceId),
Target: aws.String(a.InstanceID),
}

startSessionOutput, err := client.StartSession(context.Background(), startSessionInput)
Expand Down Expand Up @@ -74,7 +74,7 @@ func (a *AWSSSMConnection) Command(cmdLine []string) ([]byte, error) {
command := strings.Join(cmdLine, " ")
runCommandInput := &ssm.SendCommandInput{
DocumentName: aws.String("AWS-RunShellScript"),
InstanceIds: []string{a.InstanceId},
InstanceIds: []string{a.InstanceID},
Parameters: map[string][]string{
"commands": {command},
},
Expand All @@ -89,7 +89,7 @@ func (a *AWSSSMConnection) Command(cmdLine []string) ([]byte, error) {

commandInvocationInput := &ssm.GetCommandInvocationInput{
CommandId: commandId,
InstanceId: aws.String(a.InstanceId),
InstanceId: aws.String(a.InstanceID),
}

waiter := ssm.NewCommandExecutedWaiter(a.Client)
Expand Down

0 comments on commit 0fdc56c

Please sign in to comment.