permissions

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

These APIs allow you to manage Permissions, Workspace Assignment, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControlRequest

type AccessControlRequest struct {
	// name of the group
	GroupName string `json:"group_name,omitempty"`
	// Permission level
	PermissionLevel PermissionLevel `json:"permission_level,omitempty"`
	// name of the service principal
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	// name of the user
	UserName string `json:"user_name,omitempty"`
}

type AccessControlResponse

type AccessControlResponse struct {
	// All permissions.
	AllPermissions []Permission `json:"all_permissions,omitempty"`
	// name of the group
	GroupName string `json:"group_name,omitempty"`
	// name of the service principal
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	// name of the user
	UserName string `json:"user_name,omitempty"`
}

type CreateWorkspaceAssignments

type CreateWorkspaceAssignments struct {
	// Array of permissions assignments to apply to a workspace.
	PermissionAssignments []PermissionAssignmentInput `json:"permission_assignments"`
	// The workspace ID for the account.
	WorkspaceId int64 `json:"-" url:"-"`
}

type DeleteWorkspaceAssignmentRequest

type DeleteWorkspaceAssignmentRequest struct {
	// The ID of the service principal.
	PrincipalId int64 `json:"-" url:"-"`
	// The workspace ID.
	WorkspaceId int64 `json:"-" url:"-"`
}

Delete permissions assignment

type Get

type Get struct {
	RequestObjectId string `json:"-" url:"-"`
	// <needs content>
	RequestObjectType string `json:"-" url:"-"`
}

Get object permissions

type GetPermissionLevels

type GetPermissionLevels struct {
	// <needs content>
	RequestObjectId string `json:"-" url:"-"`
	// <needs content>
	RequestObjectType string `json:"-" url:"-"`
}

Get permission levels

type GetPermissionLevelsResponse

type GetPermissionLevelsResponse struct {
	// Specific permission levels
	PermissionLevels []PermissionsDescription `json:"permission_levels,omitempty"`
}

type GetWorkspaceAssignmentRequest

type GetWorkspaceAssignmentRequest struct {
	// The workspace ID.
	WorkspaceId int64 `json:"-" url:"-"`
}

List workspace permissions

type ListWorkspaceAssignmentRequest

type ListWorkspaceAssignmentRequest struct {
	// The workspace ID for the account.
	WorkspaceId int64 `json:"-" url:"-"`
}

Get permission assignments

type ObjectPermissions

type ObjectPermissions struct {
	AccessControlList []AccessControlResponse `json:"access_control_list,omitempty"`

	ObjectId string `json:"object_id,omitempty"`

	ObjectType string `json:"object_type,omitempty"`
}

type Permission

type Permission struct {
	Inherited bool `json:"inherited,omitempty"`

	InheritedFromObject []string `json:"inherited_from_object,omitempty"`
	// Permission level
	PermissionLevel PermissionLevel `json:"permission_level,omitempty"`
}

type PermissionAssignment

type PermissionAssignment struct {
	// Error response associated with a workspace permission assignment, if any.
	Error string `json:"error,omitempty"`
	// The permissions level of the service principal.
	Permissions []WorkspacePermission `json:"permissions,omitempty"`
	// Information about the service principal assigned for the workspace.
	Principal *PrincipalOutput `json:"principal,omitempty"`
}

type PermissionAssignmentInput

type PermissionAssignmentInput struct {
	// The group name for the service principal.
	GroupName string `json:"group_name,omitempty"`
	// Array of permissions to apply to the workspace for the service principal.
	Permissions []WorkspacePermission `json:"permissions"`
	// The name of the service principal.
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	// The username of the owner of the service principal.
	UserName string `json:"user_name,omitempty"`
}

type PermissionAssignments

type PermissionAssignments struct {
	// Array of permissions assignments defined for a workspace.
	PermissionAssignments []PermissionAssignment `json:"permission_assignments,omitempty"`
}

type PermissionLevel

type PermissionLevel string

Permission level

const PermissionLevelCanAttachTo PermissionLevel = `CAN_ATTACH_TO`
const PermissionLevelCanBind PermissionLevel = `CAN_BIND`
const PermissionLevelCanEdit PermissionLevel = `CAN_EDIT`
const PermissionLevelCanEditMetadata PermissionLevel = `CAN_EDIT_METADATA`
const PermissionLevelCanManage PermissionLevel = `CAN_MANAGE`
const PermissionLevelCanManageProductionVersions PermissionLevel = `CAN_MANAGE_PRODUCTION_VERSIONS`
const PermissionLevelCanManageRun PermissionLevel = `CAN_MANAGE_RUN`
const PermissionLevelCanManageStagingVersions PermissionLevel = `CAN_MANAGE_STAGING_VERSIONS`
const PermissionLevelCanRead PermissionLevel = `CAN_READ`
const PermissionLevelCanRestart PermissionLevel = `CAN_RESTART`
const PermissionLevelCanRun PermissionLevel = `CAN_RUN`
const PermissionLevelCanUse PermissionLevel = `CAN_USE`
const PermissionLevelCanView PermissionLevel = `CAN_VIEW`
const PermissionLevelCanViewMetadata PermissionLevel = `CAN_VIEW_METADATA`
const PermissionLevelIsOwner PermissionLevel = `IS_OWNER`

func (*PermissionLevel) Set added in v0.2.0

func (pl *PermissionLevel) Set(v string) error

Set raw string value and validate it against allowed values

func (*PermissionLevel) String added in v0.2.0

func (pl *PermissionLevel) String() string

String representation for fmt.Print

func (*PermissionLevel) Type added in v0.2.0

func (pl *PermissionLevel) Type() string

Type always returns PermissionLevel to satisfy [pflag.Value] interface

type PermissionOutput

type PermissionOutput struct {
	// The results of a permissions query.
	Description string `json:"description,omitempty"`

	PermissionLevel WorkspacePermission `json:"permission_level,omitempty"`
}

type PermissionsAPI

type PermissionsAPI struct {
	// contains filtered or unexported fields
}

Permissions API are used to create read, write, edit, update and manage access for various users on different objects and endpoints.

func NewPermissions

func NewPermissions(client *client.DatabricksClient) *PermissionsAPI

func (*PermissionsAPI) Get

func (a *PermissionsAPI) Get(ctx context.Context, request Get) (*ObjectPermissions, error)

Get object permissions.

Gets the permission of an object. Objects can inherit permissions from their parent objects or root objects.

func (*PermissionsAPI) GetByRequestObjectTypeAndRequestObjectId

func (a *PermissionsAPI) GetByRequestObjectTypeAndRequestObjectId(ctx context.Context, requestObjectType string, requestObjectId string) (*ObjectPermissions, error)

Get object permissions.

Gets the permission of an object. Objects can inherit permissions from their parent objects or root objects.

func (*PermissionsAPI) GetPermissionLevels

func (a *PermissionsAPI) GetPermissionLevels(ctx context.Context, request GetPermissionLevels) (*GetPermissionLevelsResponse, error)

Get permission levels.

Gets the permission levels that a user can have on an object.

func (*PermissionsAPI) GetPermissionLevelsByRequestObjectTypeAndRequestObjectId

func (a *PermissionsAPI) GetPermissionLevelsByRequestObjectTypeAndRequestObjectId(ctx context.Context, requestObjectType string, requestObjectId string) (*GetPermissionLevelsResponse, error)

Get permission levels.

Gets the permission levels that a user can have on an object.

func (*PermissionsAPI) Impl

Impl returns low-level Permissions API implementation

func (*PermissionsAPI) Set

func (a *PermissionsAPI) Set(ctx context.Context, request PermissionsRequest) error

Set permissions.

Sets permissions on object. Objects can inherit permissions from their parent objects and root objects.

func (*PermissionsAPI) Update

func (a *PermissionsAPI) Update(ctx context.Context, request PermissionsRequest) error

Update permission.

Updates the permissions on an object.

func (*PermissionsAPI) WithImpl

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type PermissionsDescription

type PermissionsDescription struct {
	Description string `json:"description,omitempty"`
	// Permission level
	PermissionLevel PermissionLevel `json:"permission_level,omitempty"`
}

type PermissionsRequest

type PermissionsRequest struct {
	AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"`

	RequestObjectId string `json:"-" url:"-"`
	// <needs content>
	RequestObjectType string `json:"-" url:"-"`
}

type PermissionsService

type PermissionsService interface {

	// Get object permissions.
	//
	// Gets the permission of an object. Objects can inherit permissions from
	// their parent objects or root objects.
	Get(ctx context.Context, request Get) (*ObjectPermissions, error)

	// Get permission levels.
	//
	// Gets the permission levels that a user can have on an object.
	GetPermissionLevels(ctx context.Context, request GetPermissionLevels) (*GetPermissionLevelsResponse, error)

	// Set permissions.
	//
	// Sets permissions on object. Objects can inherit permissions from their
	// parent objects and root objects.
	Set(ctx context.Context, request PermissionsRequest) error

	// Update permission.
	//
	// Updates the permissions on an object.
	Update(ctx context.Context, request PermissionsRequest) error
}

Permissions API are used to create read, write, edit, update and manage access for various users on different objects and endpoints.

type PrincipalOutput

type PrincipalOutput struct {
	// The display name of the service principal.
	DisplayName string `json:"display_name,omitempty"`
	// The group name for the service principal.
	GroupName string `json:"group_name,omitempty"`
	// The unique, opaque id of the principal.
	PrincipalId int64 `json:"principal_id,omitempty"`
	// The name of the service principal.
	ServicePrincipalName string `json:"service_principal_name,omitempty"`
	// The username of the owner of the service principal.
	UserName string `json:"user_name,omitempty"`
}

type UpdateWorkspaceAssignments

type UpdateWorkspaceAssignments struct {
	// Array of permissions assignments to update on the workspace.
	Permissions []WorkspacePermission `json:"permissions"`
	// The ID of the service principal.
	PrincipalId int64 `json:"-" url:"-"`
	// The workspace ID.
	WorkspaceId int64 `json:"-" url:"-"`
}

type WorkspaceAssignmentAPI

type WorkspaceAssignmentAPI struct {
	// contains filtered or unexported fields
}

Databricks Workspace Assignment REST API

func NewWorkspaceAssignment

func NewWorkspaceAssignment(client *client.DatabricksClient) *WorkspaceAssignmentAPI

func (*WorkspaceAssignmentAPI) Create

Create permission assignments.

Create new permission assignments for the specified account and workspace.

func (*WorkspaceAssignmentAPI) Delete

Delete permissions assignment.

Deletes the workspace permissions assignment for a given account and workspace using the specified service principal.

func (*WorkspaceAssignmentAPI) DeleteByWorkspaceIdAndPrincipalId

func (a *WorkspaceAssignmentAPI) DeleteByWorkspaceIdAndPrincipalId(ctx context.Context, workspaceId int64, principalId int64) error

Delete permissions assignment.

Deletes the workspace permissions assignment for a given account and workspace using the specified service principal.

func (*WorkspaceAssignmentAPI) Get

List workspace permissions.

Get an array of workspace permissions for the specified account and workspace.

func (*WorkspaceAssignmentAPI) GetByWorkspaceId

func (a *WorkspaceAssignmentAPI) GetByWorkspaceId(ctx context.Context, workspaceId int64) (*WorkspacePermissions, error)

List workspace permissions.

Get an array of workspace permissions for the specified account and workspace.

func (*WorkspaceAssignmentAPI) Impl

Impl returns low-level WorkspaceAssignment API implementation

func (*WorkspaceAssignmentAPI) ListAll

Get permission assignments.

Get the permission assignments for the specified Databricks Account and Databricks Workspace.

This method is generated by Databricks SDK Code Generator.

func (*WorkspaceAssignmentAPI) ListByWorkspaceId

func (a *WorkspaceAssignmentAPI) ListByWorkspaceId(ctx context.Context, workspaceId int64) (*PermissionAssignments, error)

Get permission assignments.

Get the permission assignments for the specified Databricks Account and Databricks Workspace.

func (*WorkspaceAssignmentAPI) Update

Update permissions assignment.

Updates the workspace permissions assignment for a given account and workspace using the specified service principal.

func (*WorkspaceAssignmentAPI) WithImpl

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type WorkspaceAssignmentService

type WorkspaceAssignmentService interface {

	// Create permission assignments.
	//
	// Create new permission assignments for the specified account and
	// workspace.
	Create(ctx context.Context, request CreateWorkspaceAssignments) (*WorkspaceAssignmentsCreated, error)

	// Delete permissions assignment.
	//
	// Deletes the workspace permissions assignment for a given account and
	// workspace using the specified service principal.
	Delete(ctx context.Context, request DeleteWorkspaceAssignmentRequest) error

	// List workspace permissions.
	//
	// Get an array of workspace permissions for the specified account and
	// workspace.
	Get(ctx context.Context, request GetWorkspaceAssignmentRequest) (*WorkspacePermissions, error)

	// Get permission assignments.
	//
	// Get the permission assignments for the specified Databricks Account and
	// Databricks Workspace.
	//
	// Use ListAll() to get all PermissionAssignment instances
	List(ctx context.Context, request ListWorkspaceAssignmentRequest) (*PermissionAssignments, error)

	// Update permissions assignment.
	//
	// Updates the workspace permissions assignment for a given account and
	// workspace using the specified service principal.
	Update(ctx context.Context, request UpdateWorkspaceAssignments) error
}

Databricks Workspace Assignment REST API

type WorkspaceAssignmentsCreated

type WorkspaceAssignmentsCreated struct {
	// Array of permissions assignments applied to a workspace.
	PermissionAssignments []PermissionAssignment `json:"permission_assignments,omitempty"`
}

type WorkspacePermission

type WorkspacePermission string
const WorkspacePermissionAdmin WorkspacePermission = `ADMIN`
const WorkspacePermissionUnknown WorkspacePermission = `UNKNOWN`
const WorkspacePermissionUser WorkspacePermission = `USER`

func (*WorkspacePermission) Set added in v0.2.0

func (wp *WorkspacePermission) Set(v string) error

Set raw string value and validate it against allowed values

func (*WorkspacePermission) String added in v0.2.0

func (wp *WorkspacePermission) String() string

String representation for fmt.Print

func (*WorkspacePermission) Type added in v0.2.0

func (wp *WorkspacePermission) Type() string

Type always returns WorkspacePermission to satisfy [pflag.Value] interface

type WorkspacePermissions

type WorkspacePermissions struct {
	// Array of permissions defined for a workspace.
	Permissions []PermissionOutput `json:"permissions,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL