Skip to content

Commit

Permalink
fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Mar 28, 2024
1 parent 7dff96c commit e26a4f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
10 changes: 3 additions & 7 deletions pkg/resources/grant_privileges_to_account_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,7 @@ func UpdateGrantPrivilegesToAccountRole(ctx context.Context, d *schema.ResourceD
id.Kind == OnSchemaObjectAccountRoleGrantKind,
)

if id.WithGrantOption {
err = client.Grants.GrantPrivilegesToAccountRole(ctx, privilegesToGrant, grantOn, id.RoleName, &sdk.GrantPrivilegesToAccountRoleOptions{
WithGrantOption: sdk.Bool(true),
})
} else {
if !id.WithGrantOption {
if err = client.Grants.RevokePrivilegesFromAccountRole(ctx, privilegesToGrant, grantOn, id.RoleName, new(sdk.RevokePrivilegesFromAccountRoleOptions)); err != nil {
return diag.Diagnostics{
diag.Diagnostic{
Expand All @@ -539,9 +535,9 @@ func UpdateGrantPrivilegesToAccountRole(ctx context.Context, d *schema.ResourceD
},
}
}

err = client.Grants.GrantPrivilegesToAccountRole(ctx, privilegesToGrant, grantOn, id.RoleName, new(sdk.GrantPrivilegesToAccountRoleOptions))
}

err = client.Grants.GrantPrivilegesToAccountRole(ctx, privilegesToGrant, grantOn, id.RoleName, new(sdk.GrantPrivilegesToAccountRoleOptions))
if err != nil {
return diag.Diagnostics{
diag.Diagnostic{
Expand Down
9 changes: 2 additions & 7 deletions pkg/resources/grant_privileges_to_database_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,7 @@ func UpdateGrantPrivilegesToDatabaseRole(ctx context.Context, d *schema.Resource
id.Kind == OnSchemaObjectDatabaseRoleGrantKind,
)

if id.WithGrantOption {
err = client.Grants.GrantPrivilegesToDatabaseRole(ctx, privilegesToGrant, grantOn, id.DatabaseRoleName, &sdk.GrantPrivilegesToDatabaseRoleOptions{
WithGrantOption: sdk.Bool(true),
})
} else {
if !id.WithGrantOption {
if err = client.Grants.RevokePrivilegesFromDatabaseRole(ctx, privilegesToGrant, grantOn, id.DatabaseRoleName, new(sdk.RevokePrivilegesFromDatabaseRoleOptions)); err != nil {
return diag.Diagnostics{
diag.Diagnostic{
Expand All @@ -465,10 +461,9 @@ func UpdateGrantPrivilegesToDatabaseRole(ctx context.Context, d *schema.Resource
},
}
}

err = client.Grants.GrantPrivilegesToDatabaseRole(ctx, privilegesToGrant, grantOn, id.DatabaseRoleName, new(sdk.GrantPrivilegesToDatabaseRoleOptions))
}

err = client.Grants.GrantPrivilegesToDatabaseRole(ctx, privilegesToGrant, grantOn, id.DatabaseRoleName, new(sdk.GrantPrivilegesToDatabaseRoleOptions))
if err != nil {
return diag.Diagnostics{
diag.Diagnostic{
Expand Down

0 comments on commit e26a4f9

Please sign in to comment.