Skip to content

Commit

Permalink
Pass strings as value
Browse files Browse the repository at this point in the history
There is no need to pass the changeset name as a pointer because it
isn't modified or empty, ever.
  • Loading branch information
rndstr committed Mar 28, 2019
1 parent 1c753f3 commit c4efdf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/cfn/manager/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ func (c *StackCollection) UpdateStack(stackName string, changeSetName string, de
if err := c.doCreateChangeSetRequest(i, changeSetName, description, template, parameters, true); err != nil {
return err
}
if err := c.doWaitUntilChangeSetIsCreated(i, &changeSetName); err != nil {
if err := c.doWaitUntilChangeSetIsCreated(i, changeSetName); err != nil {
return err
}
changeSet, err := c.DescribeStackChangeSet(i, &changeSetName)
changeSet, err := c.DescribeStackChangeSet(i, changeSetName)
if err != nil {
return err
}
Expand Down Expand Up @@ -391,17 +391,17 @@ func (c *StackCollection) doExecuteChangeSet(stackName string, changeSetName str
}

// DescribeStackChangeSet gets a cloudformation changeset.
func (c *StackCollection) DescribeStackChangeSet(i *Stack, changeSetName *string) (*ChangeSet, error) {
func (c *StackCollection) DescribeStackChangeSet(i *Stack, changeSetName string) (*ChangeSet, error) {
input := &cloudformation.DescribeChangeSetInput{
StackName: i.StackName,
ChangeSetName: changeSetName,
ChangeSetName: &changeSetName,
}
if i.StackId != nil {
input.StackName = i.StackId
}
resp, err := c.provider.CloudFormation().DescribeChangeSet(input)
if err != nil {
return nil, errors.Wrapf(err, "describing CloudFormation ChangeSet %s for stack %s", *changeSetName, *i.StackName)
return nil, errors.Wrapf(err, "describing CloudFormation ChangeSet %s for stack %s", changeSetName, *i.StackName)
}
return resp, nil
}
8 changes: 4 additions & 4 deletions pkg/cfn/manager/waiters.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func (c *StackCollection) waitWithAcceptors(i *Stack, acceptors []request.Waiter
return waiters.Wait(*i.StackName, msg, acceptors, newRequest, c.provider.WaitTimeout(), troubleshoot)
}

func (c *StackCollection) waitWithAcceptorsChangeSet(i *Stack, changesetName *string, acceptors []request.WaiterAcceptor) error {
msg := fmt.Sprintf("waiting for CloudFormation changeset %q for stack %q", *changesetName, *i.StackName)
func (c *StackCollection) waitWithAcceptorsChangeSet(i *Stack, changesetName string, acceptors []request.WaiterAcceptor) error {
msg := fmt.Sprintf("waiting for CloudFormation changeset %q for stack %q", changesetName, *i.StackName)

newRequest := func() *request.Request {
input := &cfn.DescribeChangeSetInput{
StackName: i.StackName,
ChangeSetName: changesetName,
ChangeSetName: &changesetName,
}
req, _ := c.provider.CloudFormation().DescribeChangeSetRequest(input)
return req
Expand Down Expand Up @@ -222,7 +222,7 @@ func (c *StackCollection) doWaitUntilStackIsUpdated(i *Stack) error {
)
}

func (c *StackCollection) doWaitUntilChangeSetIsCreated(i *Stack, changesetName *string) error {
func (c *StackCollection) doWaitUntilChangeSetIsCreated(i *Stack, changesetName string) error {
return c.waitWithAcceptorsChangeSet(i, changesetName,
waiters.MakeAcceptors(
changesetStatus,
Expand Down

0 comments on commit c4efdf5

Please sign in to comment.