tokenmanagement

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 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,omitempty"`
	// The number of seconds before the token expires.
	LifetimeSeconds int64 `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 Delete added in v0.2.0

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

Delete a token

type Get added in v0.2.0

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

Get token info

type List added in v0.2.0

type List 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) Delete added in v0.2.0

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

Delete a token.

Deletes a token, specified by its ID.

func (*TokenManagementAPI) DeleteByTokenId added in v0.2.0

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

Delete a token.

Deletes a token, specified by its ID.

func (*TokenManagementAPI) Get added in v0.2.0

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

Get token info.

Gets information about 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) GetByTokenId added in v0.2.0

func (a *TokenManagementAPI) GetByTokenId(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) ListAll added in v0.2.0

func (a *TokenManagementAPI) ListAll(ctx context.Context, request List) ([]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 List) (map[string]string, error)

TokenInfoCommentToTokenIdMap calls TokenManagementAPI.ListAll 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.
	Delete(ctx context.Context, request Delete) error

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

	// List all tokens.
	//
	// Lists all tokens associated with the specified workspace or user.
	//
	// Use ListAll() to get all TokenInfo instances
	List(ctx context.Context, request List) (*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