@@ -11,8 +11,6 @@ import (
1111 "github.com/databricks/databricks-sdk-go"
1212 "github.com/databricks/databricks-sdk-go/apierr"
1313 "github.com/databricks/terraform-provider-databricks/common"
14- "github.com/databricks/terraform-provider-databricks/jobs"
15- "github.com/databricks/terraform-provider-databricks/pipelines"
1614
1715 "github.com/hashicorp/go-cty/cty"
1816 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -128,7 +126,7 @@ func urlPathForObjectID(objectID string) string {
128126// permissions when POSTing permissions changes through the REST API, to avoid accidentally
129127// revoking the calling user's ability to manage the current object.
130128func (a PermissionsAPI ) shouldExplicitlyGrantCallingUserManagePermissions (objectID string ) bool {
131- for _ , prefix := range [... ]string {"/registered-models/" , "/clusters/" , "/queries/" } {
129+ for _ , prefix := range [... ]string {"/registered-models/" , "/clusters/" , "/queries/" , "/sql/warehouses" } {
132130 if strings .HasPrefix (objectID , prefix ) {
133131 return true
134132 }
@@ -220,8 +218,16 @@ func (a PermissionsAPI) Delete(objectID string) error {
220218 }
221219 }
222220 }
221+ w , err := a .client .WorkspaceClient ()
222+ if err != nil {
223+ return err
224+ }
223225 if strings .HasPrefix (objectID , "/jobs" ) {
224- job , err := jobs .NewJobsAPI (a .context , a .client ).Read (strings .ReplaceAll (objectID , "/jobs/" , "" ))
226+ jobId , err := strconv .ParseInt (strings .ReplaceAll (objectID , "/jobs/" , "" ), 10 , 0 )
227+ if err != nil {
228+ return err
229+ }
230+ job , err := w .Jobs .GetByJobId (a .context , jobId )
225231 if err != nil {
226232 return err
227233 }
@@ -230,7 +236,7 @@ func (a PermissionsAPI) Delete(objectID string) error {
230236 PermissionLevel : "IS_OWNER" ,
231237 })
232238 } else if strings .HasPrefix (objectID , "/pipelines" ) {
233- job , err := pipelines . NewPipelinesAPI (a .context , a . client ). Read ( strings .ReplaceAll (objectID , "/pipelines/" , "" ))
239+ job , err := w . Pipelines . GetByPipelineId (a .context , strings .ReplaceAll (objectID , "/pipelines/" , "" ))
234240 if err != nil {
235241 return err
236242 }
0 commit comments