Skip to content

Commit

Permalink
Update with checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdappollonio committed Jan 16, 2025
1 parent 52b9a25 commit 6d83d83
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cmd/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ func createKubernetesAdminRole(ctx context.Context, clusterName string, iamClien
// Check if the IAM policy exists
cp, err := iamClient.GetPolicy(ctx, &iam.GetPolicyInput{PolicyArn: aws.String(fmt.Sprintf("arn:aws:iam::%s:policy/%s", *callerIdentity.Account, policyName))})
if err != nil {
var newError *awshttp.ResponseError
if errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {
if newError := (&awshttp.ResponseError{}); errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {

Check failure on line 307 in cmd/aws/create.go

View workflow job for this annotation

GitHub Actions / build

empty-block: this block is empty, you can remove it (revive)
// Policy does not exist, continue
} else {
return "", fmt.Errorf("failed to get policy %q: %w", policyName, err)
Expand Down Expand Up @@ -353,8 +352,7 @@ func createKubernetesAdminRole(ctx context.Context, clusterName string, iamClien
// Check if a role with this name already exists
role, err := iamClient.GetRole(ctx, &iam.GetRoleInput{RoleName: aws.String(roleName)})
if err != nil {
var newError *awshttp.ResponseError
if errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {
if newError := (&awshttp.ResponseError{}); errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {

Check failure on line 355 in cmd/aws/create.go

View workflow job for this annotation

GitHub Actions / build

empty-block: this block is empty, you can remove it (revive)
// Role does not exist, continue
} else {
return "", fmt.Errorf("failed to get role %q: %w", roleName, err)
Expand Down

0 comments on commit 6d83d83

Please # to comment.