databricks

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrVars

type AttrVars struct {
	Attrs []string `json:"attributes"`
}

Attribute vars are used to specify which attributes to return from the API.

func NewGroupAttrVars

func NewGroupAttrVars() *AttrVars

func NewGroupRolesAttrVars

func NewGroupRolesAttrVars() *AttrVars

func NewServicePrincipalAttrVars

func NewServicePrincipalAttrVars() *AttrVars

func NewServicePrincipalRolesAttrVars

func NewServicePrincipalRolesAttrVars() *AttrVars

func NewUserAttrVars

func NewUserAttrVars() *AttrVars

func NewUserRolesAttrVars

func NewUserRolesAttrVars() *AttrVars

func (*AttrVars) Apply

func (a *AttrVars) Apply(params *url.Values)

type Auth

type Auth interface {
	Apply(req *http.Request)
	GetClient(ctx context.Context) (*http.Client, error)
}

type BaseResponse

type BaseResponse struct {
	ID string `json:"id"`
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func NewBasicAuth

func NewBasicAuth(username, password string) *BasicAuth

func (*BasicAuth) Apply

func (b *BasicAuth) Apply(req *http.Request)

func (*BasicAuth) GetClient

func (b *BasicAuth) GetClient(ctx context.Context) (*http.Client, error)

type Client

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

func NewClient

func NewClient(ctx context.Context, httpClient *http.Client, hostname, accountHostname, accountID string, auth Auth) (*Client, error)

func (*Client) CreateOrUpdateWorkspaceMember

func (c *Client) CreateOrUpdateWorkspaceMember(
	ctx context.Context,
	workspaceId string,
	principalId string,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindGroupDisplayName

func (c *Client) FindGroupDisplayName(
	ctx context.Context,
	workspaceId,
	groupID string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindGroupID

func (c *Client) FindGroupID(
	ctx context.Context,
	workspaceId string,
	displayName string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindServicePrincipalAppID

func (c *Client) FindServicePrincipalAppID(
	ctx context.Context,
	workspaceId string,
	servicePrincipalID string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindServicePrincipalID

func (c *Client) FindServicePrincipalID(
	ctx context.Context,
	workspaceId string,
	appID string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindUserID

func (c *Client) FindUserID(
	ctx context.Context,
	workspaceId string,
	username string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) FindUsername

func (c *Client) FindUsername(
	ctx context.Context,
	workspaceId string,
	userID string,
) (
	string,
	*v2.RateLimitDescription,
	error,
)

func (*Client) Get

func (c *Client) Get(
	ctx context.Context,
	urlAddress *url.URL,
	response interface{},
	params ...Vars,
) (*v2.RateLimitDescription, error)

func (*Client) GetAccountId

func (c *Client) GetAccountId() string

func (*Client) GetGroup

func (c *Client) GetGroup(ctx context.Context, workspaceId, groupId string) (
	*Group,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetServicePrincipal

func (c *Client) GetServicePrincipal(
	ctx context.Context,
	workspaceId string,
	servicePrincipalID string,
) (
	*ServicePrincipal,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetUser

func (c *Client) GetUser(
	ctx context.Context,
	workspaceId string,
	userId string,
) (
	*User,
	*v2.RateLimitDescription,
	error,
)

func (*Client) IsAccountAPIAvailable

func (c *Client) IsAccountAPIAvailable() bool

func (*Client) IsTokenAuth

func (c *Client) IsTokenAuth() bool

func (*Client) IsWorkspaceAPIAvailable

func (c *Client) IsWorkspaceAPIAvailable() bool

func (*Client) ListGroups

func (c *Client) ListGroups(
	ctx context.Context,
	workspaceId string,
	vars ...Vars,
) (
	[]Group,
	uint,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListRoles

func (c *Client) ListRoles(
	ctx context.Context,
	workspaceId string,
	resourceType string,
	resourceId string,
) (
	[]Role,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListRuleSets

func (c *Client) ListRuleSets(
	ctx context.Context,
	workspaceId string,
	resourceType string,
	resourceId string,
) (
	[]RuleSet,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListServicePrincipals

func (c *Client) ListServicePrincipals(
	ctx context.Context,
	workspaceId string,
	vars ...Vars,
) (
	[]ServicePrincipal,
	uint,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListUsers

func (c *Client) ListUsers(
	ctx context.Context,
	workspaceId string,
	vars ...Vars,
) (
	[]User,
	uint,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListWorkspaceMembers

func (c *Client) ListWorkspaceMembers(
	ctx context.Context,
	workspaceId string,
) (
	[]WorkspaceAssignment,
	*v2.RateLimitDescription,
	error,
)

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(
	ctx context.Context,
) (
	[]Workspace,
	*v2.RateLimitDescription,
	error,
)

func (*Client) Put

func (c *Client) Put(
	ctx context.Context,
	urlAddress *url.URL,
	body interface{},
	response interface{},
	params ...Vars,
) (*v2.RateLimitDescription, error)

func (*Client) RemoveWorkspaceMember

func (c *Client) RemoveWorkspaceMember(
	ctx context.Context,
	workspaceId string,
	principalId string,
) (*v2.RateLimitDescription, error)

func (*Client) UpdateAvailability

func (c *Client) UpdateAvailability(accAPI, wsAPI bool)

func (*Client) UpdateEtag

func (c *Client) UpdateEtag(etag string)

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(ctx context.Context, workspaceId string, group *Group) (*v2.RateLimitDescription, error)

func (*Client) UpdateRuleSets

func (c *Client) UpdateRuleSets(
	ctx context.Context,
	workspaceId, resourceType, resourceId string,
	ruleSets []RuleSet,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) UpdateServicePrincipal

func (c *Client) UpdateServicePrincipal(
	ctx context.Context,
	workspaceId string,
	servicePrincipal *ServicePrincipal,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, workspaceId string, user *User) (*v2.RateLimitDescription, error)

type FilterVars

type FilterVars struct {
	Filter string `json:"filter"`
}

Filter vars are used for filtering results from the API.

func NewFilterVars

func NewFilterVars(filter string) *FilterVars

func (*FilterVars) Apply

func (f *FilterVars) Apply(params *url.Values)

type Group

type Group struct {
	BaseResponse
	Permissions
	DisplayName string   `json:"displayName"`
	Members     []Member `json:"members,omitempty"`
	Meta        struct {
		Type string `json:"resourceType"`
	} `json:"meta,omitempty"`
	Schemas []string `json:"schemas,omitempty"`
}

func (Group) HaveEntitlement

func (g Group) HaveEntitlement(entitlement string) bool

func (Group) HaveRole

func (g Group) HaveRole(role string) bool

func (Group) IsAccountGroup

func (g Group) IsAccountGroup() bool

type ListResponse

type ListResponse[T any] struct {
	Resources []T  `json:"Resources"`
	Total     uint `json:"totalResults"`
}

type Member

type Member struct {
	ID          string `json:"value"`
	DisplayName string `json:"display"`
	Ref         string `json:"$ref"`
}

type NameVars

type NameVars struct {
	Etag    string `json:"etag"`
	Payload string `json:"name"`
}

func NewNameVars

func NewNameVars(name string, etag string) *NameVars

func (*NameVars) Apply

func (n *NameVars) Apply(params *url.Values)

type NoAuth

type NoAuth struct{}

func (*NoAuth) Apply

func (n *NoAuth) Apply(req *http.Request)

func (*NoAuth) GetClient

func (n *NoAuth) GetClient(ctx context.Context) (*http.Client, error)

type OAuth2

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

func NewOAuth2

func NewOAuth2(accId, clientId, clientSecret string) *OAuth2

func (*OAuth2) Apply

func (o *OAuth2) Apply(req *http.Request)

func (*OAuth2) GetClient

func (o *OAuth2) GetClient(ctx context.Context) (*http.Client, error)

type PaginationVars

type PaginationVars struct {
	Start uint `json:"startIndex"`
	Count uint `json:"count"`
}

Pagination vars are used for paginating results from the API.

func NewPaginationVars

func NewPaginationVars(start uint, count uint) *PaginationVars

func (*PaginationVars) Apply

func (p *PaginationVars) Apply(params *url.Values)

type PermissionValue

type PermissionValue struct {
	Value string `json:"value"`
}

type Permissions

type Permissions struct {
	Roles        []PermissionValue `json:"roles,omitempty"`
	Entitlements []PermissionValue `json:"entitlements,omitempty"`
}

type ResourceVars

type ResourceVars struct {
	Payload string `json:"resource"`
}

func NewResourceVars

func NewResourceVars(resource string) *ResourceVars

func (*ResourceVars) Apply

func (r *ResourceVars) Apply(params *url.Values)

type Role

type Role struct {
	Name string `json:"name"`
}

type RuleSet

type RuleSet struct {
	Principals []string `json:"principals"`
	Role       string   `json:"role"`
}

type ServicePrincipal

type ServicePrincipal struct {
	BaseResponse
	Permissions
	DisplayName   string `json:"displayName"`
	Active        bool   `json:"active"`
	ApplicationID string `json:"applicationId"`
}

func (ServicePrincipal) HaveEntitlement

func (s ServicePrincipal) HaveEntitlement(entitlement string) bool

func (ServicePrincipal) HaveRole

func (s ServicePrincipal) HaveRole(role string) bool

type TokenAuth

type TokenAuth struct {
	Tokens           map[string]string
	CurrentWorkspace string
}

func NewTokenAuth

func NewTokenAuth(workspaces, tokens []string) *TokenAuth

func (*TokenAuth) Apply

func (t *TokenAuth) Apply(req *http.Request)

func (*TokenAuth) GetClient

func (t *TokenAuth) GetClient(ctx context.Context) (*http.Client, error)

func (*TokenAuth) SetWorkspace

func (t *TokenAuth) SetWorkspace(workspace string)

type User

type User struct {
	BaseResponse
	Permissions
	Emails []struct {
		Primary bool   `json:"primary"`
		Value   string `json:"value"`
	} `json:"emails"`
	UserName    string `json:"userName"`
	DisplayName string `json:"displayName"`
	Active      bool   `json:"active,omitempty"`
}

func (User) HaveEntitlement

func (u User) HaveEntitlement(entitlement string) bool

func (User) HaveRole

func (u User) HaveRole(role string) bool

type Vars

type Vars interface {
	Apply(params *url.Values)
}

type Workspace

type Workspace struct {
	ID             int    `json:"workspace_id"`
	Name           string `json:"workspace_name"`
	Status         string `json:"workspace_status"`
	DeploymentName string `json:"deployment_name"`
}

type WorkspaceAssignment

type WorkspaceAssignment struct {
	Principal *WorkspacePrincipal `json:"principal"`
}

type WorkspacePrincipal

type WorkspacePrincipal struct {
	ServicePrincipalAppID string `json:"service_principal_name"`
	GroupDisplayName      string `json:"group_name"`
	UserName              string `json:"user_name"`
	ID                    int    `json:"principal_id"`
}

Jump to

Keyboard shortcuts

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