tokenmanagement

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Enables administrators to get all tokens and delete tokens for other users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOboTokenRequest

type CreateOboTokenRequest struct {
	// Application ID of the service principal.
	ApplicationId string `json:"application_id"`
	// Comment that describes the purpose of the token.
	Comment string `json:"comment"`
	// The number of seconds before the token expires.
	LifetimeSeconds any `json:"lifetime_seconds"`
}

type CreateOboTokenResponse

type CreateOboTokenResponse struct {
	TokenInfo *TokenInfo `json:"token_info,omitempty"`
	// Value of the token.
	TokenValue string `json:"token_value,omitempty"`
}

type DeleteToken

type DeleteToken struct {
	// The ID of the token to get.
	TokenId string `json:"-" url:"-"`
}

Delete a token

type GetTokenInfo

type GetTokenInfo struct {
	// The ID of the token to get.
	TokenId string `json:"-" url:"-"`
}

Get token info

type ListTokens

type ListTokens struct {
	// User ID of the user that created the token.
	CreatedById string `json:"-" url:"created_by_id,omitempty"`
	// Username of the user that created the token.
	CreatedByUsername string `json:"-" url:"created_by_username,omitempty"`
}

List all tokens

type ListTokensResponse

type ListTokensResponse struct {
	TokenInfos []TokenInfo `json:"token_infos,omitempty"`
}

type TokenInfo

type TokenInfo struct {
	// Comment that describes the purpose of the token, specified by the token
	// creator.
	Comment string `json:"comment,omitempty"`
	// User ID of the user that created the token.
	CreatedById int64 `json:"created_by_id,omitempty"`
	// Username of the user that created the token.
	CreatedByUsername string `json:"created_by_username,omitempty"`
	// Timestamp when the token was created.
	CreationTime int64 `json:"creation_time,omitempty"`
	// Timestamp when the token expires.
	ExpiryTime int64 `json:"expiry_time,omitempty"`
	// User ID of the user that owns the token.
	OwnerId int64 `json:"owner_id,omitempty"`
	// ID of the token.
	TokenId string `json:"token_id,omitempty"`
}

type TokenManagementAPI

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

Enables administrators to get all tokens and delete tokens for other users. Admins can either get every token, get a specific token by ID, or get all tokens for a particular user.

func NewTokenManagement

func NewTokenManagement(client *client.DatabricksClient) *TokenManagementAPI

func (*TokenManagementAPI) CreateOboToken

Create on-behalf token

Creates a token on behalf of a service principal.

func (*TokenManagementAPI) DeleteToken

func (a *TokenManagementAPI) DeleteToken(ctx context.Context, request DeleteToken) error

Delete a token

Deletes a token, specified by its ID.

func (*TokenManagementAPI) DeleteTokenByTokenId

func (a *TokenManagementAPI) DeleteTokenByTokenId(ctx context.Context, tokenId string) error

Delete a token

Deletes a token, specified by its ID.

func (*TokenManagementAPI) GetByComment

func (a *TokenManagementAPI) GetByComment(ctx context.Context, name string) (*TokenInfo, error)

GetByComment calls TokenManagementAPI.TokenInfoCommentToTokenIdMap and returns a single TokenInfo.

Returns an error if there's more than one TokenInfo with the same .Comment.

Note: All TokenInfo instances are loaded into memory before returning matching by name.

This method is generated by Databricks SDK Code Generator.

func (*TokenManagementAPI) GetTokenInfo

func (a *TokenManagementAPI) GetTokenInfo(ctx context.Context, request GetTokenInfo) (*TokenInfo, error)

Get token info

Gets information about a token, specified by its ID.

func (*TokenManagementAPI) GetTokenInfoByTokenId

func (a *TokenManagementAPI) GetTokenInfoByTokenId(ctx context.Context, tokenId string) (*TokenInfo, error)

Get token info

Gets information about a token, specified by its ID.

func (*TokenManagementAPI) Impl

Impl returns low-level TokenManagement API implementation

func (*TokenManagementAPI) ListTokensAll

func (a *TokenManagementAPI) ListTokensAll(ctx context.Context, request ListTokens) ([]TokenInfo, error)

List all tokens

Lists all tokens associated with the specified workspace or user.

This method is generated by Databricks SDK Code Generator.

func (*TokenManagementAPI) TokenInfoCommentToTokenIdMap

func (a *TokenManagementAPI) TokenInfoCommentToTokenIdMap(ctx context.Context, request ListTokens) (map[string]string, error)

TokenInfoCommentToTokenIdMap calls TokenManagementAPI.ListTokensAll and creates a map of results with TokenInfo.Comment as key and TokenInfo.TokenId as value.

Returns an error if there's more than one TokenInfo with the same .Comment.

Note: All TokenInfo instances are loaded into memory before creating a map.

This method is generated by Databricks SDK Code Generator.

func (*TokenManagementAPI) 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 TokenManagementService

type TokenManagementService interface {

	// Create on-behalf token
	//
	// Creates a token on behalf of a service principal.
	CreateOboToken(ctx context.Context, request CreateOboTokenRequest) (*CreateOboTokenResponse, error)

	// Delete a token
	//
	// Deletes a token, specified by its ID.
	DeleteToken(ctx context.Context, request DeleteToken) error

	// Get token info
	//
	// Gets information about a token, specified by its ID.
	GetTokenInfo(ctx context.Context, request GetTokenInfo) (*TokenInfo, error)

	// List all tokens
	//
	// Lists all tokens associated with the specified workspace or user.
	//
	// Use ListTokensAll() to get all TokenInfo instances
	ListTokens(ctx context.Context, request ListTokens) (*ListTokensResponse, error)
}

Enables administrators to get all tokens and delete tokens for other users. Admins can either get every token, get a specific token by ID, or get all tokens for a particular user.

Jump to

Keyboard shortcuts

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