Skip to content

Commit

Permalink
Private fields
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Jan 26, 2024
1 parent c5dcc23 commit 62500c7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/client/connection_aws_ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
type AWSSSMConnection struct {
InstanceID string
Region string
Client *ssm.Client
SessionId *string

context context.Context
client *ssm.Client
sessionId *string
context context.Context
}

func (a *AWSSSMConnection) Info() string {
Expand Down Expand Up @@ -52,17 +52,17 @@ func (a *AWSSSMConnection) Connect() error {
return fmt.Errorf("ssm: error starting session: %v", err)
}

a.Client = client
a.SessionId = startSessionOutput.SessionId
a.client = client
a.sessionId = startSessionOutput.SessionId

return nil
}

func (a *AWSSSMConnection) Disconnect() error {
// Disconnect from the session
terminateSessionInput := &ssm.TerminateSessionInput{SessionId: a.SessionId}
terminateSessionInput := &ssm.TerminateSessionInput{SessionId: a.sessionId}

_, err := a.Client.TerminateSession(a.context, terminateSessionInput)
_, err := a.client.TerminateSession(a.context, terminateSessionInput)
if err != nil {
return fmt.Errorf("ssm: error terminating session: %v", err)
}
Expand All @@ -79,7 +79,7 @@ func (a *AWSSSMConnection) Command(cmdLine []string) ([]byte, error) {
"commands": {command},
},
}
runOut, err := a.Client.SendCommand(a.context, runCommandInput)
runOut, err := a.client.SendCommand(a.context, runCommandInput)
if err != nil {
return nil, fmt.Errorf("ssm: error executing command: %v", err)
}
Expand All @@ -89,13 +89,13 @@ func (a *AWSSSMConnection) Command(cmdLine []string) ([]byte, error) {
CommandId: commandId,
InstanceId: aws.String(a.InstanceID),
}
waiter := ssm.NewCommandExecutedWaiter(a.Client)
waiter := ssm.NewCommandExecutedWaiter(a.client)
_, err = waiter.WaitForOutput(a.context, invocationIn, time.Hour)
if err != nil {
return nil, fmt.Errorf("ssm: error executing command: %v", err)
}

invocationOut, err := a.Client.GetCommandInvocation(a.context, invocationIn)
invocationOut, err := a.client.GetCommandInvocation(a.context, invocationIn)
if err != nil {
return nil, fmt.Errorf("ssm: error executing command: %v", err)
}
Expand Down

0 comments on commit 62500c7

Please sign in to comment.