From 9888d49eec0ec81d1a9a9c51c19fb2b8536cc74a Mon Sep 17 00:00:00 2001 From: Artur Sawicki Date: Wed, 6 Nov 2024 14:36:20 +0100 Subject: [PATCH] Extract MANAGE SHARE TARGET to enum References: #3153 --- .../grant_privileges_to_account_role_acceptance_test.go | 6 +++--- pkg/sdk/privileges.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/resources/grant_privileges_to_account_role_acceptance_test.go b/pkg/resources/grant_privileges_to_account_role_acceptance_test.go index 2374f9bc86..f0302e4674 100644 --- a/pkg/resources/grant_privileges_to_account_role_acceptance_test.go +++ b/pkg/resources/grant_privileges_to_account_role_acceptance_test.go @@ -75,7 +75,7 @@ func TestAcc_GrantPrivilegesToAccountRole_OnAccount_gh3153(t *testing.T) { configVariables := config.Variables{ "name": config.StringVariable(roleFullyQualifiedName), "privileges": config.ListVariable( - config.StringVariable("MANAGE SHARE TARGET"), + config.StringVariable(string(sdk.GlobalPrivilegeManageShareTarget)), ), } resourceName := "snowflake_grant_privileges_to_account_role.test" @@ -99,9 +99,9 @@ func TestAcc_GrantPrivilegesToAccountRole_OnAccount_gh3153(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "account_role_name", roleFullyQualifiedName), resource.TestCheckResourceAttr(resourceName, "privileges.#", "1"), - resource.TestCheckResourceAttr(resourceName, "privileges.0", "MANAGE SHARE TARGET"), + resource.TestCheckResourceAttr(resourceName, "privileges.0", string(sdk.GlobalPrivilegeManageShareTarget)), resource.TestCheckResourceAttr(resourceName, "on_account", "true"), - resource.TestCheckResourceAttr(resourceName, "id", fmt.Sprintf("%s|false|false|MANAGE SHARE TARGET|OnAccount", roleFullyQualifiedName)), + resource.TestCheckResourceAttr(resourceName, "id", fmt.Sprintf("%s|false|false|%s|OnAccount", roleFullyQualifiedName, sdk.GlobalPrivilegeManageShareTarget)), ), }, }, diff --git a/pkg/sdk/privileges.go b/pkg/sdk/privileges.go index 8b2d792ee6..7f8cd38f42 100644 --- a/pkg/sdk/privileges.go +++ b/pkg/sdk/privileges.go @@ -48,6 +48,7 @@ const ( GlobalPrivilegeManageOrganizationSupportCases GlobalPrivilege = "MANAGE ORGANIZATION SUPPORT CASES" GlobalPrivilegeManageUserSupportCases GlobalPrivilege = "MANAGE USER SUPPORT CASES" GlobalPrivilegeManageWarehouses GlobalPrivilege = "MANAGE WAREHOUSES" + GlobalPrivilegeManageShareTarget GlobalPrivilege = "MANAGE SHARE TARGET" GlobalPrivilegeModifyLogLevel GlobalPrivilege = "MODIFY LOG LEVEL" GlobalPrivilegeModifyTraceLevel GlobalPrivilege = "MODIFY TRACE LEVEL"