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 6d83d83 commit 4f2b84e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ 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 {
if newError := (&awshttp.ResponseError{}); errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {
var newError awshttp.ResponseError
if errors.As(err, &newError) && newError.HTTPStatusCode() == http.StatusNotFound {

Check failure on line 308 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 @@ -352,7 +353,8 @@ 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 {
if newError := (&awshttp.ResponseError{}); errors.As(err, newError) && newError.HTTPStatusCode() == http.StatusNotFound {
var newError awshttp.ResponseError
if errors.As(err, &newError) && newError.HTTPStatusCode() == http.StatusNotFound {

Check failure on line 357 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 4f2b84e

Please # to comment.