func (a PermissionsAPI) Update(objectID string, objectACL AccessControlChangeList) error {
	if objectID == "/authorization/tokens" {
		objectACL.AccessControlList = append(objectACL.AccessControlList, AccessControlChange{
			GroupName:       "admins",
			PermissionLevel: "CAN_MANAGE",
		})
	}
	if strings.HasPrefix(objectID, "/jobs") {
		owners := 0
		for _, acl := range objectACL.AccessControlList {
			if acl.PermissionLevel == "IS_OWNER" {
				owners++
			}
		}
		if owners == 0 {
			me, err := identity.NewUsersAPI(a.context, a.client).Me()
			if err != nil {
				return err
			}
			objectACL.AccessControlList = append(objectACL.AccessControlList, AccessControlChange{
				UserName:        me.UserName,
				PermissionLevel: "IS_OWNER",
			})
		}
	}
	return a.put(objectID, objectACL)
}
Update updates object permissions. Technically, it's using method named SetOrDelete, but here we do more
package access
import (
	"context"
	"fmt"
	"log"
	"path"
	"strconv"
	"strings"
	"github.com/databrickslabs/terraform-provider-databricks/common"
	"github.com/databrickslabs/terraform-provider-databricks/compute"
	"github.com/databrickslabs/terraform-provider-databricks/identity"
	"github.com/databrickslabs/terraform-provider-databricks/workspace"
	"github.com/hashicorp/go-cty/cty"
	"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
	"github.com/pkg/errors"
)
type ObjectACL struct {
	ObjectID          string          `json:"object_id,omitempty"`
	ObjectType        string          `json:"object_type,omitempty"`
	AccessControlList []AccessControl `json:"access_control_list"`
}
type AccessControl struct {
	UserName             string       `json:"user_name,omitempty"`
	GroupName            string       `json:"group_name,omitempty"`
	ServicePrincipalName string       `json:"service_principal_name,omitempty"`
	AllPermissions       []Permission `json:"all_permissions,omitempty"`
	PermissionLevel string `json:"permission_level,omitempty"`
}
func (ac AccessControl) toAccessControlChange() (AccessControlChange, bool) {
	for _, permission := range ac.AllPermissions {
		if permission.Inherited {
			continue
		}
		return AccessControlChange{
			PermissionLevel:      permission.PermissionLevel,
			UserName:             ac.UserName,
			GroupName:            ac.GroupName,
			ServicePrincipalName: ac.ServicePrincipalName,
		}, true
	}
	if ac.PermissionLevel != "" {
		return AccessControlChange{
			PermissionLevel:      ac.PermissionLevel,
			UserName:             ac.UserName,
			GroupName:            ac.GroupName,
			ServicePrincipalName: ac.ServicePrincipalName,
		}, true
	}
	return AccessControlChange{}, false
}
func (ac AccessControl) String() string {
	return fmt.Sprintf("%s%s%s%v", ac.GroupName, ac.UserName, ac.ServicePrincipalName, ac.AllPermissions)
}
type Permission struct {
	PermissionLevel     string   `json:"permission_level"`
	Inherited           bool     `json:"inherited,omitempty"`
	InheritedFromObject []string `json:"inherited_from_object,omitempty"`
}
func (p Permission) String() string {
	if len(p.InheritedFromObject) > 0 {
		return fmt.Sprintf("%s (from %s)", p.PermissionLevel, p.InheritedFromObject)
	}
	return p.PermissionLevel
}
type AccessControlChangeList struct {
	AccessControlList []AccessControlChange `json:"access_control_list"`
}
type AccessControlChange struct {
	UserName             string `json:"user_name,omitempty"`
	GroupName            string `json:"group_name,omitempty"`
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	PermissionLevel      string `json:"permission_level"`
}
func (acc AccessControlChange) String() string {
	return fmt.Sprintf("%v%v%v %s", acc.UserName, acc.GroupName, acc.ServicePrincipalName,
		acc.PermissionLevel)
}
func NewPermissionsAPI(ctx context.Context, m interface{}) PermissionsAPI {
	return PermissionsAPI{
		client:  m.(*common.DatabricksClient),
		context: ctx,
	}
}
type PermissionsAPI struct {
	client  *common.DatabricksClient
	context context.Context
}
func urlPathForObjectID(objectID string) string {
	if strings.HasPrefix(objectID, "/sql/") && !strings.HasPrefix(objectID, "/sql/endpoints") {
		return "/preview/sql/permissions" + objectID[4:]
	}
	return "/permissions" + objectID
}
func (a PermissionsAPI) put(objectID string, objectACL AccessControlChangeList) error {
	if strings.HasPrefix(objectID, "/sql/") {
		me, err := identity.NewUsersAPI(a.context, a.client).Me()
		if err != nil {
			return err
		}
		objectACL.AccessControlList = append(objectACL.AccessControlList, AccessControlChange{
			UserName:        me.UserName,
			PermissionLevel: "CAN_MANAGE",
		})
		if strings.HasPrefix(objectID, "/sql/endpoints/") {
			return a.client.Patch(a.context, urlPathForObjectID(objectID), objectACL)
		} else {
			return a.client.Post(a.context, urlPathForObjectID(objectID), objectACL, nil)
		}
	}
	return a.client.Put(a.context, urlPathForObjectID(objectID), objectACL)
}