keboola

package
v1.26.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package keboola contains request definitions for all supported Keboola APIs. The definitions are not complete and can be extended as needed. Requests can be sent by any HTTP client that implements the client.Sender interface. It is necessary to set API host and "X-StorageApi-Token" header in the HTTP client, see the NewAPI function.

nolint: dupl

nolint: dupl

nolint: dupl

nolint: dupl

nolint: dupl

Example (NewAPIFromIndexWithComponents)
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/keboola/go-client/pkg/keboola"
)

func main() {
	ctx := context.TODO()
	host := "connection.keboola.com"

	// Load services list and components at once
	index, err := keboola.APIIndexWithComponents(ctx, host)
	if err != nil {
		log.Fatal(err)
	}

	// Create API
	publicAPI := keboola.NewPublicAPIFromIndex(host, &index.Index)

	// Authorize
	api := publicAPI.WithToken("<my-token>")

	// Get default branch
	defaultBranch, err := api.GetDefaultBranchRequest().Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	// Send request
	buckets, err := api.ListBucketsRequest(defaultBranch.ID).Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%#v", buckets)
}
Output:

Index

Examples

Constants

View Source
const (
	EncryptionAPI = ServiceType("encryption")
	QueueAPI      = ServiceType("queue")
	SchedulerAPI  = ServiceType("scheduler")
	StorageAPI    = ServiceType("storage")
	WorkspacesAPI = ServiceType("sandboxes")
	// Deprecated: Syrup and old queue should no longer be used.
	// See https://changelog.keboola.com/2021-11-10-what-is-new-queue/ for information on how to migrate your project.
	SyrupAPI = ServiceType("syrup")
)
View Source
const (
	OldQueueJobStatusWaiting     string = "waiting"
	OldQueueJobStatusProcessing  string = "processing"
	OldQueueJobStatusSuccess     string = "success"
	OldQueueJobStatusCancelled   string = "cancelled"
	OldQueueJobStatusError       string = "error"
	OldQueueJobStatusWarning     string = "warning"
	OldQueueJobStatusTerminating string = "terminating"
	OldQueueJobStatusTerminated  string = "terminated"
)
View Source
const (
	BucketStageIn  = "in"
	BucketStageOut = "out"
	BucketStageSys = "sys"
)
View Source
const (
	VariablesComponentID     = ComponentID(`keboola.variables`)
	SchedulerComponentID     = ComponentID("keboola.scheduler")
	SharedCodeComponentID    = ComponentID("keboola.shared-code")
	OrchestratorComponentID  = ComponentID("keboola.orchestrator")
	WorkspaceComponentID     = ComponentID("keboola.sandboxes")
	DataAppsComponentID      = ComponentID("keboola.data-apps")
	TransformationType       = "transformation"
	DeprecatedFlag           = `deprecated`
	ExcludeFromNewListFlag   = `excludeFromNewList`
	GenericCodeBlocksUIFlag  = `genericCodeBlocksUI`
	ComponentTypeCodePattern = `code-pattern`
	ComponentTypeProcessor   = `processor`
)

Component constants.

View Source
const (
	WorkspaceSizeSmall  = "small"
	WorkspaceSizeMedium = "medium"
	WorkspaceSizeLarge  = "large"
)
View Source
const (
	WorkspaceTypeSnowflake = "snowflake"
	WorkspaceTypePython    = "python"
	WorkspaceTypeR         = "r"
)
View Source
const ManifestFileName = "manifest"
View Source
const TimeFormat = "2006-01-02T15:04:05Z"

TimeFormat used in Workspaces API.

View Source
const WorkspacesComponent = "keboola.sandboxes"

Variables

This section is empty.

Functions

func CleanProject

func CleanProject(
	ctx context.Context,
	api *AuthorizedAPI,
) error

func Download added in v1.4.0

func Download(ctx context.Context, file *FileDownloadCredentials) ([]byte, error)

func DownloadManifestReader added in v1.4.0

func DownloadManifestReader(ctx context.Context, file *FileDownloadCredentials) (io.ReadCloser, error)

func DownloadReader added in v1.4.0

func DownloadReader(ctx context.Context, file *FileDownloadCredentials) (io.ReadCloser, error)

func DownloadSlice added in v1.4.0

func DownloadSlice(ctx context.Context, file *FileDownloadCredentials, slice string) (out []byte, err error)

func DownloadSliceReader added in v1.4.0

func DownloadSliceReader(ctx context.Context, file *FileDownloadCredentials, slice string, opts ...DownloadOption) (io.ReadCloser, error)

func IsEncrypted

func IsEncrypted(value string) bool

IsEncrypted returns true if value match format of encrypted value.

func IsKeyToEncrypt

func IsKeyToEncrypt(key string) bool

IsKeyToEncrypt returns true if given key represents an encrypted value.

func NewSliceURL

func NewSliceURL(file *FileUploadCredentials, slice string) (string, error)

func NewUploadSliceWriter

func NewUploadSliceWriter(ctx context.Context, file *FileUploadCredentials, slice string, opts ...UploadOption) (*blob.Writer, error)

NewUploadSliceWriter instantiates a Writer to the Storage given by cloud provider specified in the File resource and to the specified slice.

func NewUploadWriter

func NewUploadWriter(ctx context.Context, file *FileUploadCredentials, opts ...UploadOption) (*blob.Writer, error)

NewUploadWriter instantiates a Writer to the Storage given by cloud provider specified in the File resource.

func SortComponents

func SortComponents(components Components)

SortComponents by name, keboola vendor will be first.

func Upload

func Upload(ctx context.Context, file *FileUploadCredentials, fr io.Reader) (written int64, err error)

Upload instantiates a Writer to the Storage given by cloud provider specified in the File resource and writes there content of the reader.

func UploadSlice

func UploadSlice(ctx context.Context, file *FileUploadCredentials, slice string, fr io.Reader) (written int64, err error)

UploadSlice instantiates a Writer to the Storage given by cloud provider specified in the File resource and writes content of the reader to the specified slice.

func UploadSlicedFileManifest

func UploadSlicedFileManifest(ctx context.Context, file *FileUploadCredentials, slices []string) (written int64, err error)

UploadSlicedFileManifest instantiates a Writer to the Storage given by cloud provider specified in the File resource and writes content of the reader to the specified slice manifest.

func WithChangedSince added in v1.1.0

func WithChangedSince(value string) withChangedSince

Filtering by import date - timestamp of import is stored within each row. Can be a unix timestamp or any date accepted by strtotime (https://www.php.net/manual/en/function.strtotime.php).

func WithChangedUntil added in v1.1.0

func WithChangedUntil(value string) withChangedUntil

Filtering by import date - timestamp of import is stored within each row. Can be a unix timestamp or any date accepted by strtotime (https://www.php.net/manual/en/function.strtotime.php).

func WithColumnsHeaders

func WithColumnsHeaders(c []string) columnsHeadersOption

func WithContentType added in v1.2.0

func WithContentType(v string) withContentType

func WithDelimiter

func WithDelimiter(d string) delimiterOption

func WithDisableEncryption added in v1.2.0

func WithDisableEncryption() withDisableEncryption

func WithEnclosure

func WithEnclosure(e string) enclosureOption

func WithEscapedBy

func WithEscapedBy(e string) escapedByOption

func WithExportColumns added in v1.1.0

func WithExportColumns(columns ...string) withExportColumns

List of columns to export. By default all columns are exported.

func WithIncrementalLoad

func WithIncrementalLoad(i bool) incrementalLoadOption

func WithIsPermanent added in v1.2.0

func WithIsPermanent(v bool) withIsPermanent

func WithIsSliced added in v1.2.0

func WithIsSliced(v bool) withIsSliced

func WithLimitRows added in v1.1.0

func WithLimitRows(value uint) withLimitRows

Limit the number of returned rows.

Maximum allowed value is 1000.

Default value is 100.

func WithNotify added in v1.2.0

func WithNotify(v bool) withNotify

func WithOrderBy added in v1.1.0

func WithOrderBy(column string, order ColumnOrder, ty ...DataType) orderBy

func WithPrimaryKey

func WithPrimaryKey(pk []string) primaryKeyOption

func WithSizeBytes added in v1.2.0

func WithSizeBytes(v uint64) withSizeBytes

func WithTags added in v1.2.0

func WithTags(v ...string) withTags

func WithWhere added in v1.1.0

func WithWhere[T any](column string, op CompareOp, values []T, ty ...DataType) whereFilter

If the column contains a numeric type, `ty` may be used to specify the exact type.

`ty` should be exactly one value, or empty.

func WithoutHeader

func WithoutHeader(h bool) withoutHeaderOption

func WorkspaceSizesMap

func WorkspaceSizesMap() map[string]bool

func WorkspaceSizesOrdered

func WorkspaceSizesOrdered() []string

func WorkspaceSupportsSizes

func WorkspaceSupportsSizes(typ string) bool

func WorkspaceTypesMap

func WorkspaceTypesMap() map[string]bool

func WorkspaceTypesOrdered

func WorkspaceTypesOrdered() []string

Types

type ABSDownloadParams added in v1.4.0

type ABSDownloadParams = abs.DownloadParams

type APIOption

type APIOption func(c *apiConfig)

func WithClient

func WithClient(cl *client.Client) APIOption

func WithMeterProvider added in v1.15.0

func WithMeterProvider(v otelMetric.MeterProvider) APIOption

func WithTracerProvider added in v1.15.0

func WithTracerProvider(v otelTrace.TracerProvider) APIOption

type AuthorizedAPI added in v1.19.0

type AuthorizedAPI struct {
	*PublicAPI
	// contains filtered or unexported fields
}

func APIClientForAnEmptyProject

func APIClientForAnEmptyProject(t *testing.T, ctx context.Context, opts ...testproject.Option) (*testproject.Project, *AuthorizedAPI)

func APIClientForRandomProject

func APIClientForRandomProject(t *testing.T, ctx context.Context, opts ...testproject.Option) (*testproject.Project, *AuthorizedAPI)

func NewAuthorizedAPI added in v1.19.0

func NewAuthorizedAPI(ctx context.Context, host, token string, opts ...APIOption) (*AuthorizedAPI, error)
Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/keboola/go-client/pkg/keboola"
)

func main() {
	ctx := context.TODO()
	host := "connection.keboola.com"
	token := "<my-token>"

	// Create API
	api, err := keboola.NewAuthorizedAPI(ctx, host, token)
	if err != nil {
		log.Fatal(err)
	}

	// Get default branch
	defaultBranch, err := api.GetDefaultBranchRequest().Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	// Send request
	buckets, err := api.ListBucketsRequest(defaultBranch.ID).Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%#v", buckets)
}
Output:

func (*AuthorizedAPI) ActivateScheduleRequest added in v1.19.0

func (a *AuthorizedAPI) ActivateScheduleRequest(configID ConfigID, configurationVersionID string) request.APIRequest[*Schedule]

ActivateScheduleRequest https://app.swaggerhub.com/apis/odinuv/scheduler/1.0.0#/schedules/activate

func (*AuthorizedAPI) AppendConfigMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) AppendConfigMetadataRequest(key ConfigKey, metadata Metadata) request.APIRequest[request.NoResult]

AppendConfigMetadataRequest https://keboola.docs.apiary.io/#reference/metadata/components-configurations-metadata/create-or-update

func (*AuthorizedAPI) AppendMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) AppendMetadataRequest(key any, metadata map[string]string) request.APIRequest[request.NoResult]

AppendMetadataRequest creates request to append object metadata according its type.

func (*AuthorizedAPI) CleanAllSchedulesRequest added in v1.19.0

func (a *AuthorizedAPI) CleanAllSchedulesRequest() request.APIRequest[request.NoResult]

CleanAllSchedulesRequest cleans all schedules in whole project. Useful for E2E tests.

func (*AuthorizedAPI) CleanProjectRequest added in v1.19.0

func (a *AuthorizedAPI) CleanProjectRequest() request.APIRequest[*Branch]

CleanProjectRequest cleans the whole project, the default branch is reset to the default state and other branches are deleted. Useful for E2E tests. Result is default branch.

func (*AuthorizedAPI) CleanWorkspaceInstances added in v1.19.0

func (a *AuthorizedAPI) CleanWorkspaceInstances(ctx context.Context) error

func (*AuthorizedAPI) CreateBranchAsyncRequest added in v1.19.0

func (a *AuthorizedAPI) CreateBranchAsyncRequest(branch *Branch) request.APIRequest[*StorageJob]

CreateBranchAsyncRequest https://keboola.docs.apiary.io/#reference/development-branches/branches/create-branch

func (*AuthorizedAPI) CreateBranchRequest added in v1.19.0

func (a *AuthorizedAPI) CreateBranchRequest(branch *Branch) request.APIRequest[*Branch]

CreateBranchRequest https://keboola.docs.apiary.io/#reference/development-branches/branches/create-branch

func (*AuthorizedAPI) CreateBucketRequest added in v1.19.0

func (a *AuthorizedAPI) CreateBucketRequest(bucket *Bucket) request.APIRequest[*Bucket]

CreateBucketRequest https://keboola.docs.apiary.io/#reference/buckets/create-or-list-buckets/create-bucket

func (*AuthorizedAPI) CreateEventRequest added in v1.19.0

func (a *AuthorizedAPI) CreateEventRequest(event *Event) request.APIRequest[*Event]

CreateEventRequest https://keboola.docs.apiary.io/#reference/events/events/create-event

func (*AuthorizedAPI) CreateFileResourceRequest added in v1.19.0

func (a *AuthorizedAPI) CreateFileResourceRequest(branchID BranchID, name string, opts ...CreateFileOption) request.APIRequest[*FileUploadCredentials]

CreateFileResourceRequest https://keboola.docs.apiary.io/#reference/files/upload-file/create-file-resource

func (*AuthorizedAPI) CreateOldQueueJobRequest deprecated added in v1.19.0

func (a *AuthorizedAPI) CreateOldQueueJobRequest(
	componentID ComponentID,
	configID ConfigID,
	opts ...OldQueueJobOption,
) request.APIRequest[*CreateJobResult]

Deprecated: CreateOldQueueJobRequest is deprecated because the old queue should no longer be used. See https://changelog.keboola.com/2021-11-10-what-is-new-queue/ for information on how to migrate your project.

CreateOldQueueJobRequest https://kebooladocker.docs.apiary.io/#reference/run/create-a-job/run-job

func (*AuthorizedAPI) CreateOrUpdateTableMetadata added in v1.19.0

func (a *AuthorizedAPI) CreateOrUpdateTableMetadata(k TableKey, provider string, tableMetadata []TableMetadataRequest, columnsMetadata []ColumnMetadataRequest) request.APIRequest[*TableMetadataResponse]

CreateOrUpdateTableMetadata https://keboola.docs.apiary.io/#reference/metadata/table-metadata/create-or-update

func (*AuthorizedAPI) CreateQueueJobConfigDataRequest deprecated added in v1.19.0

func (a *AuthorizedAPI) CreateQueueJobConfigDataRequest(componentID ComponentID, configID ConfigID, configData map[string]any) request.APIRequest[*QueueJob]

Deprecated: Use `NewCreateJobRequest` instead.

CreateQueueJobConfigDataRequest - https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/createJob

Allows setting configData.

`configId` can be set to an empty string, and it will be omitted.

func (*AuthorizedAPI) CreateQueueJobRequest deprecated added in v1.19.0

func (a *AuthorizedAPI) CreateQueueJobRequest(componentID ComponentID, configID ConfigID) request.APIRequest[*QueueJob]

Deprecated: Use `NewCreateJobRequest` instead.

CreateQueueJobRequest - https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/createJob

func (*AuthorizedAPI) CreateRequest added in v1.19.0

func (a *AuthorizedAPI) CreateRequest(object Object) request.APIRequest[Object]

CreateRequest creates request to create object according its type.

func (*AuthorizedAPI) CreateTableDefinitionAsyncRequest added in v1.20.0

func (a *AuthorizedAPI) CreateTableDefinitionAsyncRequest(k TableKey, definition TableDefinition) request.APIRequest[*StorageJob]

func (*AuthorizedAPI) CreateTableDefinitionRequest added in v1.20.0

func (a *AuthorizedAPI) CreateTableDefinitionRequest(k TableKey, definition TableDefinition) request.APIRequest[*Table]

func (*AuthorizedAPI) CreateTableRequest added in v1.19.0

func (a *AuthorizedAPI) CreateTableRequest(k TableKey, columns []string, opts ...CreateTableOption) request.APIRequest[*Table]

CreateTableRequest creates an empty table with given columns.

func (*AuthorizedAPI) CreateWorkspace added in v1.19.0

func (a *AuthorizedAPI) CreateWorkspace(
	ctx context.Context,
	branchID BranchID,
	workspaceName string,
	workspaceType string,
	opts ...CreateWorkspaceOption,
) (*WorkspaceWithConfig, error)

func (*AuthorizedAPI) CreateWorkspaceConfigRequest added in v1.19.0

func (a *AuthorizedAPI) CreateWorkspaceConfigRequest(branchID BranchID, name string) request.APIRequest[*ConfigWithRows]

func (*AuthorizedAPI) CreateWorkspaceJobRequest added in v1.19.0

func (a *AuthorizedAPI) CreateWorkspaceJobRequest(configID ConfigID, workspaceType string, opts ...CreateWorkspaceOption) request.APIRequest[request.NoResult]

func (*AuthorizedAPI) DeleteBranchAsyncRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteBranchAsyncRequest(key BranchKey) request.APIRequest[*StorageJob]

DeleteBranchAsyncRequest https://keboola.docs.apiary.io/#reference/development-branches/branch-manipulation/delete-branch

func (*AuthorizedAPI) DeleteBranchMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteBranchMetadataRequest(branch BranchKey, metaID string) request.APIRequest[request.NoResult]

DeleteBranchMetadataRequest https://keboola.docs.apiary.io/#reference/metadata/development-branch-metadata/delete

func (*AuthorizedAPI) DeleteBucketAsyncRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteBucketAsyncRequest(k BucketKey, opts ...DeleteOption) request.APIRequest[*StorageJob]

DeleteBucketAsyncRequest https://keboola.docs.apiary.io/#reference/buckets/manage-bucket/drop-bucket

func (*AuthorizedAPI) DeleteBucketRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteBucketRequest(k BucketKey, opts ...DeleteOption) request.APIRequest[request.NoResult]

DeleteBucketRequest https://keboola.docs.apiary.io/#reference/buckets/manage-bucket/drop-bucket

func (*AuthorizedAPI) DeleteConfigMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteConfigMetadataRequest(key ConfigKey, metaID string) request.APIRequest[request.NoResult]

DeleteConfigMetadataRequest https://keboola.docs.apiary.io/#reference/metadata/components-configurations-metadata/delete

func (*AuthorizedAPI) DeleteConfigsInBranchRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteConfigsInBranchRequest(branch BranchKey) request.APIRequest[request.NoResult]

DeleteConfigsInBranchRequest lists all configs in branch and deletes them all.

func (*AuthorizedAPI) DeleteFileRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteFileRequest(k FileKey) request.APIRequest[request.NoResult]

DeleteFileRequest https://keboola.docs.apiary.io/#reference/files/manage-files/delete-file

func (*AuthorizedAPI) DeleteMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteMetadataRequest(key any, metaID string) request.APIRequest[request.NoResult]

DeleteMetadataRequest creates request to delete object metadata according its type.

func (*AuthorizedAPI) DeleteRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteRequest(key any) request.APIRequest[request.NoResult]

DeleteRequest creates request to delete object according its type.

func (*AuthorizedAPI) DeleteScheduleRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteScheduleRequest(key ScheduleKey) request.APIRequest[request.NoResult]

DeleteScheduleRequest https://app.swaggerhub.com/apis/odinuv/scheduler/1.0.0#/schedules/deleteSchedule

func (*AuthorizedAPI) DeleteSchedulesForConfigurationRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteSchedulesForConfigurationRequest(configID ConfigID) request.APIRequest[request.NoResult]

DeleteSchedulesForConfigurationRequest https://app.swaggerhub.com/apis/odinuv/scheduler/1.0.0#/schedules/deleteSchedulesForConfiguration

func (*AuthorizedAPI) DeleteTableRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteTableRequest(k TableKey, opts ...DeleteOption) request.APIRequest[request.NoResult]

DeleteTableRequest https://keboola.docs.apiary.io/#reference/tables/manage-tables/drop-table

func (*AuthorizedAPI) DeleteTokenRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteTokenRequest(tokenID string) request.APIRequest[*Token]

DeleteTokenRequest (no documentation).

func (*AuthorizedAPI) DeleteWorkspace added in v1.19.0

func (a *AuthorizedAPI) DeleteWorkspace(
	ctx context.Context,
	branchID BranchID,
	configID ConfigID,
	workspaceID WorkspaceID,
) error

func (*AuthorizedAPI) DeleteWorkspaceConfigRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteWorkspaceConfigRequest(branchID BranchID, configID ConfigID) request.APIRequest[request.NoResult]

func (*AuthorizedAPI) DeleteWorkspaceJobRequest added in v1.19.0

func (a *AuthorizedAPI) DeleteWorkspaceJobRequest(workspaceID WorkspaceID) request.APIRequest[request.NoResult]

func (*AuthorizedAPI) GenerateIDRequest added in v1.19.0

func (a *AuthorizedAPI) GenerateIDRequest() request.APIRequest[*Ticket]

GenerateIDRequest https://keboola.docs.apiary.io/#reference/tickets/generate-unique-id/generate-new-id

func (*AuthorizedAPI) GetBucketRequest added in v1.19.0

func (a *AuthorizedAPI) GetBucketRequest(k BucketKey) request.APIRequest[*Bucket]

GetBucketRequest https://keboola.docs.apiary.io/#reference/buckets/manage-bucket/bucket-detail

func (*AuthorizedAPI) GetDefaultBranchRequest added in v1.19.0

func (a *AuthorizedAPI) GetDefaultBranchRequest() request.APIRequest[*Branch]

GetDefaultBranchRequest lists all branches and returns the default branch.

func (*AuthorizedAPI) GetFileRequest added in v1.19.0

func (a *AuthorizedAPI) GetFileRequest(k FileKey) request.APIRequest[*File]

GetFileRequest https://keboola.docs.apiary.io/#reference/files/manage-files/file-detail

func (*AuthorizedAPI) GetFileWithCredentialsRequest added in v1.19.0

func (a *AuthorizedAPI) GetFileWithCredentialsRequest(k FileKey) request.APIRequest[*FileDownloadCredentials]

GetFileWithCredentialsRequest https://keboola.docs.apiary.io/#reference/files/manage-files/file-detail

func (*AuthorizedAPI) GetOldQueueJobRequest deprecated added in v1.19.0

func (a *AuthorizedAPI) GetOldQueueJobRequest(
	jobID JobID,
	opts ...GetOldQueueJobOption,
) request.APIRequest[*JobDetail]

Deprecated: GetOldQueueJobRequest is deprecated because the old queue should no longer be used. See https://changelog.keboola.com/2021-11-10-what-is-new-queue/ for information on how to migrate your project.

GetOldQueueJobRequest https://syrupqueue.docs.apiary.io/#reference/jobs/job/view-job-detail

func (*AuthorizedAPI) GetQueueJobRequest added in v1.19.0

func (a *AuthorizedAPI) GetQueueJobRequest(key JobKey) request.APIRequest[*QueueJob]

GetJobRequest https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/getJob

func (*AuthorizedAPI) GetStorageJobRequest added in v1.19.0

func (a *AuthorizedAPI) GetStorageJobRequest(key StorageJobKey) request.APIRequest[*StorageJob]

GetStorageJobRequest https://keboola.docs.apiary.io/#reference/jobs/manage-jobs/job-detail

func (*AuthorizedAPI) GetTableRequest added in v1.19.0

func (a *AuthorizedAPI) GetTableRequest(k TableKey) request.APIRequest[*Table]

GetTableRequest https://keboola.docs.apiary.io/#reference/tables/manage-tables/table-detail

func (*AuthorizedAPI) GetWorkspace added in v1.19.0

func (a *AuthorizedAPI) GetWorkspace(
	ctx context.Context,
	branchID BranchID,
	configID ConfigID,
) (*WorkspaceWithConfig, error)

func (*AuthorizedAPI) GetWorkspaceConfigRequest added in v1.19.0

func (a *AuthorizedAPI) GetWorkspaceConfigRequest(branchID BranchID, configID ConfigID) request.APIRequest[*Config]

func (*AuthorizedAPI) GetWorkspaceInstanceRequest added in v1.19.0

func (a *AuthorizedAPI) GetWorkspaceInstanceRequest(workspaceID WorkspaceID) request.APIRequest[*Workspace]

func (*AuthorizedAPI) ListBranchMetadataRequest added in v1.19.0

func (a *AuthorizedAPI) ListBranchMetadataRequest(key BranchKey) request.APIRequest[*MetadataDetails]

ListBranchMetadataRequest https://keboola.docs.apiary.io/#reference/metadata/development-branch-metadata/list

func (*AuthorizedAPI) ListBranchesRequest added in v1.19.0

func (a *AuthorizedAPI) ListBranchesRequest() request.APIRequest[*[]*Branch]

ListBranchesRequest https://keboola.docs.apiary.io/#reference/development-branches/branches/list-branches

func (*AuthorizedAPI) ListBucketsRequest added in v1.19.0

func (a *AuthorizedAPI) ListBucketsRequest(branchID BranchID, opts ...ListBucketsOption) request.APIRequest[*[]*Bucket]

ListBucketsRequest https://keboola.docs.apiary.io/#reference/buckets/create-or-list-buckets/list-all-buckets

func (*AuthorizedAPI) ListConfigRequest added in v1.19.0

func (a *AuthorizedAPI) ListConfigRequest(branchID BranchID, componentID ComponentID) request.APIRequest[*[]*Config]

func (*AuthorizedAPI) ListFilesRequest added in v1.19.0

func (a *AuthorizedAPI) ListFilesRequest(branchID BranchID) request.APIRequest[*[]*File]

ListFilesRequest https://keboola.docs.apiary.io/#reference/files/list-files

func (*AuthorizedAPI) ListSchedulesRequest added in v1.19.0

func (a *AuthorizedAPI) ListSchedulesRequest() request.APIRequest[*[]*Schedule]

ListSchedulesRequest https://app.swaggerhub.com/apis/odinuv/scheduler/1.0.0#/schedules/get_schedules

func (*AuthorizedAPI) ListTablesRequest added in v1.19.0

func (a *AuthorizedAPI) ListTablesRequest(branchID BranchID, opts ...ListTableOption) request.APIRequest[*[]*Table]

ListTablesRequest https://keboola.docs.apiary.io/#reference/tables/list-tables/list-all-tables

func (*AuthorizedAPI) ListWorkspaceConfigRequest added in v1.19.0

func (a *AuthorizedAPI) ListWorkspaceConfigRequest(branchID BranchID) request.APIRequest[*[]*Config]

func (*AuthorizedAPI) ListWorkspaceInstancesRequest added in v1.19.0

func (a *AuthorizedAPI) ListWorkspaceInstancesRequest() request.APIRequest[*[]*Workspace]

func (*AuthorizedAPI) ListWorkspaces added in v1.19.0

func (a *AuthorizedAPI) ListWorkspaces(
	ctx context.Context,
	branchID BranchID,
) ([]*WorkspaceWithConfig, error)

func (*AuthorizedAPI) LoadDataFromFileRequest added in v1.19.0

func (a *AuthorizedAPI) LoadDataFromFileRequest(tableKey TableKey, fileKey FileKey, opts ...LoadDataOption) request.APIRequest[*StorageJob]

LoadDataFromFileRequest https://keboola.docs.apiary.io/#reference/tables/load-data-asynchronously/import-data

func (*AuthorizedAPI) NewCreateJobRequest added in v1.19.0

func (a *AuthorizedAPI) NewCreateJobRequest(componentID ComponentID) *CreateQueueJobRequestBuilder

NewCreateJobRequest - https://app.swaggerhub.com/apis-docs/keboola/job-queue-api/1.3.2#/Jobs/createJob

func (*AuthorizedAPI) NewTableUnloadRequest added in v1.19.0

func (a *AuthorizedAPI) NewTableUnloadRequest(k TableKey) *TableUnloadRequestBuilder

func (*AuthorizedAPI) PreviewTableRequest added in v1.19.0

func (a *AuthorizedAPI) PreviewTableRequest(k TableKey, opts ...PreviewOption) request.APIRequest[*TablePreview]

func (*AuthorizedAPI) RefreshTokenRequest added in v1.19.0

func (a *AuthorizedAPI) RefreshTokenRequest(tokenID string) request.APIRequest[*Token]

RefreshTokenRequest https://keboola.docs.apiary.io/#reference/tokens-and-permissions/share-token/refresh-token

func (*AuthorizedAPI) UpdateBranchRequest added in v1.19.0

func (a *AuthorizedAPI) UpdateBranchRequest(branch *Branch, changedFields []string) request.APIRequest[*Branch]

UpdateBranchRequest https://keboola.docs.apiary.io/#reference/development-branches/branches/update-branch

func (*AuthorizedAPI) UpdateRequest added in v1.19.0

func (a *AuthorizedAPI) UpdateRequest(object Object, changedFields []string) request.APIRequest[Object]

UpdateRequest creates request to update object according its type.

func (*AuthorizedAPI) WaitForOldQueueJob deprecated added in v1.19.0

func (a *AuthorizedAPI) WaitForOldQueueJob(ctx context.Context, id JobID) (err error)

Deprecated: WaitForOldQueueJob is deprecated because the old queue should no longer be used. See https://changelog.keboola.com/2021-11-10-what-is-new-queue/ for information on how to migrate your project.

WaitForOldQueueJob pulls job status until it is completed.

func (*AuthorizedAPI) WaitForQueueJob added in v1.19.0

func (a *AuthorizedAPI) WaitForQueueJob(ctx context.Context, id JobID) (err error)

WaitForQueueJob pulls job status until it is completed.

func (*AuthorizedAPI) WaitForStorageJob added in v1.19.0

func (a *AuthorizedAPI) WaitForStorageJob(ctx context.Context, job *StorageJob) (err error)

WaitForStorageJob pulls job status until it is completed.

type BaseType added in v1.20.0

type BaseType string
const (
	TypeInt       BaseType = "INTEGER"
	TypeBoolean   BaseType = "BOOLEAN"
	TypeDate      BaseType = "DATE"
	TypeFloat     BaseType = "FLOAT"
	TypeNumeric   BaseType = "NUMERIC"
	TypeString    BaseType = "STRING"
	TypeTimestamp BaseType = "TIMESTAMP"
)

func (BaseType) String added in v1.20.0

func (bt BaseType) String() string

type Branch

type Branch struct {
	BranchKey
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Created     iso8601.Time `json:"created" readonly:"true"`
	IsDefault   bool         `json:"isDefault" readonly:"true"`
}

Branch https://keboola.docs.apiary.io/#reference/development-branches/branches/list-branches

type BranchID

type BranchID int

BranchID is an ID of a development branch in Storage API.

func (BranchID) String

func (id BranchID) String() string

type BranchKey

type BranchKey struct {
	ID BranchID `json:"id" writeoptional:"true"`
}

BranchKey is a unique identifier of a branch.

func (BranchKey) ObjectID

func (k BranchKey) ObjectID() any

type Bucket

type Bucket struct {
	BucketKey
	URI            string        `json:"uri"`
	DisplayName    string        `json:"displayName"`
	Description    string        `json:"description"`
	Created        iso8601.Time  `json:"created"`
	LastChangeDate *iso8601.Time `json:"lastChangeDate"`
	IsReadOnly     bool          `json:"isReadOnly"`
	DataSizeBytes  uint64        `json:"dataSizeBytes"`
	RowsCount      uint64        `json:"rowsCount"`
}

type BucketID

type BucketID struct {
	Stage      string `validate:"required,oneof=in out sys"`
	BucketName string `validate:"required,min=1,max=96"`
}

func MustParseBucketID

func MustParseBucketID(v string) BucketID

func ParseBucketID

func ParseBucketID(v string) (BucketID, error)

func (BucketID) MarshalJSON

func (v BucketID) MarshalJSON() ([]byte, error)

func (BucketID) String

func (v BucketID) String() string

func (*BucketID) UnmarshalJSON

func (v *BucketID) UnmarshalJSON(data []byte) error

type BucketKey added in v1.17.0

type BucketKey struct {
	BranchID BranchID `json:"-"`
	BucketID BucketID `json:"id"`
}

func (BucketKey) String added in v1.21.0

func (v BucketKey) String() string

type BucketPermission

type BucketPermission string
const (
	BucketPermissionRead  BucketPermission = "read"
	BucketPermissionWrite BucketPermission = "write"
)

type BucketPermissions

type BucketPermissions map[BucketID]BucketPermission

func (BucketPermissions) MarshalJSON

func (r BucketPermissions) MarshalJSON() ([]byte, error)

func (*BucketPermissions) UnmarshalJSON

func (r *BucketPermissions) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding. The API returns empty array when the results field is empty.

type Clustering added in v1.26.2

type Clustering struct {
	Fields []string `json:"fields"`
}

type Column added in v1.20.0

type Column struct {
	Name       string            `json:"name"`
	Definition *ColumnDefinition `json:"definition,omitempty"`
	*BaseType  `json:"basetype,omitempty"`
}

type ColumnDefinition added in v1.20.0

type ColumnDefinition struct {
	Type     string `json:"type"`
	Length   string `json:"length"`
	Nullable bool   `json:"nullable"`
	Default  string `json:"default"`
}

type ColumnMetadata

type ColumnMetadata []MetadataDetail

type ColumnMetadataRequest added in v1.16.5

type ColumnMetadataRequest struct {
	ColumnName string `json:"columnName"`
	Key        string `json:"key"`
	Value      string `json:"value"`
}

type ColumnOrder added in v1.7.0

type ColumnOrder string
const (
	OrderAsc  ColumnOrder = "ASC"
	OrderDesc ColumnOrder = "DESC"
)

func ParseColumnOrder added in v1.7.0

func ParseColumnOrder(s string) (ColumnOrder, error)

ParseColumnOrder parses a column order from a string.

Available column order types:

 name | constant name
------|---------------
 ASC  | OrderAsc
 DESC | OrderDesc

If you know the column order ahead of time, you can use the associated constant instead of parsing it from a string.

type Columns added in v1.23.0

type Columns []Column

func (Columns) Names added in v1.23.0

func (v Columns) Names() (out []string)

type ColumnsMetadata added in v1.16.5

type ColumnsMetadata map[string]ColumnMetadata

func (*ColumnsMetadata) UnmarshalJSON added in v1.16.5

func (r *ColumnsMetadata) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding. The API returns empty value as empty array.

type CompareOp added in v1.7.0

type CompareOp string
const (
	CompareEq CompareOp = "eq"
	CompareNe CompareOp = "ne"
	CompareGt CompareOp = "gt"
	CompareGe CompareOp = "ge"
	CompareLt CompareOp = "lt"
	CompareLe CompareOp = "le"
)

func ParseCompareOp added in v1.7.0

func ParseCompareOp(s string) (CompareOp, error)

ParseCompareOp parses a comparison operator from a string.

Available comparison operators:

 identifier | symbol | constant name
------------|--------|---------------
 eq         | =      | CompareEq
 ne         | !=     | CompareNe
 lt         | <      | CompareLt
 le         | <=     | CompareLe
 gt         | >      | CompareGt
 ge         | >=     | CompareGe

This function accepts either the identifier or the symbol as valid input. If you know the comparison operator ahead of time, you can use the associated constant instead of parsing it from a string.

type Component

type Component struct {
	ComponentKey
	Type           string                 `json:"type"`
	Name           string                 `json:"name"`
	Flags          []string               `json:"flags,omitempty"`
	Schema         json.RawMessage        `json:"configurationSchema,omitempty"`
	SchemaRow      json.RawMessage        `json:"configurationRowSchema,omitempty"`
	EmptyConfig    *orderedmap.OrderedMap `json:"emptyConfiguration,omitempty"`
	EmptyConfigRow *orderedmap.OrderedMap `json:"emptyConfigurationRow,omitempty"`
	Data           ComponentData          `json:"data"`
}

Component https://keboola.docs.apiary.io/#reference/components-and-configurations/get-development-branch-components/get-development-branch-components

func (*Component) IsCodePattern

func (c *Component) IsCodePattern() bool

IsCodePattern returns true, if component is IsCodePattern.

func (*Component) IsDeprecated

func (c *Component) IsDeprecated() bool

IsDeprecated returns true, if component is deprecated.

func (*Component) IsExcludedFromNewList

func (c *Component) IsExcludedFromNewList() bool

IsExcludedFromNewList returns true, if component should be excluded from list of available new components.

func (*Component) IsOrchestrator

func (c *Component) IsOrchestrator() bool

IsOrchestrator returns true, if component is orchestration.

func (*Component) IsProcessor

func (c *Component) IsProcessor() bool

IsProcessor returns true, if component is processor.

func (*Component) IsScheduler

func (c *Component) IsScheduler() bool

IsScheduler returns true, if component is scheduler.

func (*Component) IsSharedCode

func (c *Component) IsSharedCode() bool

IsSharedCode returns true, if component is shared code.

func (*Component) IsTransformation

func (c *Component) IsTransformation() bool

IsTransformation returns true, if component is transformation.

func (*Component) IsTransformationWithBlocks

func (c *Component) IsTransformationWithBlocks() bool

func (*Component) IsVariables

func (c *Component) IsVariables() bool

IsVariables returns true, if component has "variables" typ.

type ComponentData

type ComponentData struct {
	DefaultBucket      bool   `json:"default_bucket"`       //nolint: tagliatelle
	DefaultBucketStage string `json:"default_bucket_stage"` //nolint: tagliatelle
}

ComponentData https://keboola.docs.apiary.io/#reference/components-and-configurations/get-development-branch-components/get-development-branch-components

type ComponentID

type ComponentID string

ComponentID is id of a Keboola component.

func (ComponentID) String

func (v ComponentID) String() string

func (ComponentID) WithoutVendor

func (v ComponentID) WithoutVendor() string

type ComponentKey

type ComponentKey struct {
	ID ComponentID `json:"id"`
}

ComponentKey is a unique identifier of a component.

type ComponentWithConfigs

type ComponentWithConfigs struct {
	BranchID BranchID `json:"branchId"`
	Component
	Configs []*ConfigWithRows `json:"configurations"`
}

ComponentWithConfigs is result of ListConfigsAndRowsFrom request.

type Components

type Components []*Component

Components slice.

func (Components) NewComponentList

func (v Components) NewComponentList() Components

NewComponentList returns only the components that should be included in list of available new components.

func (Components) ToMap

func (v Components) ToMap() ComponentsMap

ToMap converts Components slice to ComponentsMap.

type ComponentsMap

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

ComponentsMap is immutable map of components, see Components.ToMap.

func (ComponentsMap) ForEach

func (m ComponentsMap) ForEach(fn func(component *Component))

func (ComponentsMap) Get

func (m ComponentsMap) Get(id ComponentID) (*Component, bool)

type Config

type Config struct {
	ConfigKey
	Name              string                 `json:"name"`
	Description       string                 `json:"description"`
	ChangeDescription string                 `json:"changeDescription"`
	IsDeleted         bool                   `json:"isDeleted" readonly:"true"`
	Created           iso8601.Time           `json:"created" readonly:"true"`
	Version           int                    `json:"version" readonly:"true"`
	State             *orderedmap.OrderedMap `json:"state" readonly:"true"`
	IsDisabled        bool                   `json:"isDisabled"`
	Content           *orderedmap.OrderedMap `json:"configuration"`
}

Config https://keboola.docs.apiary.io/#reference/components-and-configurations/component-configurations/list-configurations

type ConfigID

type ConfigID string

ConfigID represents an ID of a configuration in Storage API.

func (ConfigID) String

func (v ConfigID) String() string

type ConfigKey

type ConfigKey struct {
	BranchID    BranchID    `json:"branchId"`
	ComponentID ComponentID `json:"componentId"`
	ID          ConfigID    `json:"id" writeas:"configurationId" writeoptional:"true"`
}

ConfigKey is a unique identifier of a configuration.

func (ConfigKey) ObjectID

func (k ConfigKey) ObjectID() any

type ConfigMetadataItem

type ConfigMetadataItem struct {
	BranchID    BranchID
	ComponentID ComponentID     `json:"idComponent"`
	ConfigID    ConfigID        `json:"configurationId"`
	Metadata    MetadataDetails `json:"metadata"`
}

ConfigMetadataItem is one item of configuration metadata.

type ConfigRow

type ConfigRow struct {
	ConfigRowKey
	Name              string                 `json:"name"`
	Description       string                 `json:"description"`
	ChangeDescription string                 `json:"changeDescription"`
	IsDisabled        bool                   `json:"isDisabled"`
	Version           int                    `json:"version" readonly:"true"`
	State             *orderedmap.OrderedMap `json:"state" readonly:"true"`
	Content           *orderedmap.OrderedMap `json:"configuration"`
}

ConfigRow https://keboola.docs.apiary.io/#reference/components-and-configurations/component-configurations/list-configurations

type ConfigRowKey

type ConfigRowKey struct {
	BranchID    BranchID    `json:"-"`
	ComponentID ComponentID `json:"-"`
	ConfigID    ConfigID    `json:"-"`
	ID          RowID       `json:"id" writeas:"rowId" writeoptional:"true"`
}

ConfigRowKey is a unique identifier of ConfigRow.

func (ConfigRowKey) ObjectID

func (k ConfigRowKey) ObjectID() any

type ConfigWithRows

type ConfigWithRows struct {
	*Config
	Rows []*ConfigRow `json:"rows"`
}

ConfigWithRows is a configuration with its configuration rows.

func (*ConfigWithRows) SortRows

func (c *ConfigWithRows) SortRows()

SortRows by name.

type ConfigsMetadata

type ConfigsMetadata []*ConfigMetadataItem

ConfigsMetadata slice.

func (ConfigsMetadata) ToMap

func (v ConfigsMetadata) ToMap() map[ConfigKey]Metadata

ToMap converts slice to map.

type CreateFileOption added in v1.2.0

type CreateFileOption interface {
	// contains filtered or unexported methods
}

type CreateJobResult added in v1.3.0

type CreateJobResult struct {
	ID     JobID  `json:"id"`
	URL    string `json:"url"`
	Status string `json:"status"`
}

type CreateQueueJobRequestBuilder added in v1.5.0

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

func (*CreateQueueJobRequestBuilder) Build added in v1.5.0

Build finalizes and builds the request.

This is useful if you want to send many of these requests in parallel.

func (*CreateQueueJobRequestBuilder) Send added in v1.5.0

Send builds the request and immediately sends it.

This is a convenience method that simply calls Build() followed by Send(ctx).

func (*CreateQueueJobRequestBuilder) WithBackendSize added in v1.5.0

WithMode starts the component job with a specific backend size.

The available sizes are: xsmall, small, medium, large.

func (*CreateQueueJobRequestBuilder) WithBranch added in v1.5.0

WithBranch starts the component job in a dev branch.

If not provided, defaults to the main branch.

func (*CreateQueueJobRequestBuilder) WithConfig added in v1.5.0

WithConfig starts the component job using a configuration.

At least one of `WithConfig`, `WithConfigData` is required. If both are provided, `configData` overrides the `config`.

func (*CreateQueueJobRequestBuilder) WithConfigData added in v1.5.0

WithConfigData starts the component job using configuration data.

At least one of `WithConfig`, `WithConfigData` is required. If both are provided, `configData` overrides the `config`.

func (*CreateQueueJobRequestBuilder) WithConfigRowIDs added in v1.5.0

WithConfigRowIDs starts the component job using only the specified row IDs.

func (*CreateQueueJobRequestBuilder) WithMode added in v1.5.0

WithMode starts the component job in a different mode.

The available modes are:

- Debug, which outputs a snapshot of configuration and a snapshot of output as storage files, but does not perform output mapping to storage.

- ForceRun, which forces a configuration to run even if it is disabled.

func (*CreateQueueJobRequestBuilder) WithTag added in v1.5.0

WithTag causes the component job to be run with a specific version of the component's docker image.

If not provided, defaults to the latest tag.

func (*CreateQueueJobRequestBuilder) WithVariableValuesData added in v1.5.0

func (b *CreateQueueJobRequestBuilder) WithVariableValuesData(values []VariableData) *CreateQueueJobRequestBuilder

func (*CreateQueueJobRequestBuilder) WithVariableValuesID added in v1.5.0

type CreateTableOption

type CreateTableOption interface {
	// contains filtered or unexported methods
}

CreateTableOption applies to the request for creating table from file.

type CreateTableRequest added in v1.20.0

type CreateTableRequest struct {
	TableDefinition
	Name string `json:"name"`
}

type CreateTokenOption

type CreateTokenOption func(*createTokenOptions)

func WithBucketPermission

func WithBucketPermission(bucketID BucketID, perm BucketPermission) CreateTokenOption

WithBucketPermission adds `bucket` to the set of buckets this token may read or write to, depending on the permission specified (`perm`).

func WithBucketPermissions

func WithBucketPermissions(v BucketPermissions) CreateTokenOption

WithBucketPermissions set token buckets permissions.

func WithCanManageBuckets

func WithCanManageBuckets(canManageBuckets bool) CreateTokenOption

WithCanManageBuckets gives the newly created token the ability to manage buckets.

func WithCanPurgeTrash

func WithCanPurgeTrash(canPurgeTrash bool) CreateTokenOption

WithCanPurgeTrash allows this token to permanently delete configurations.

func WithCanReadAllFileUploads

func WithCanReadAllFileUploads(canReadAllFileUploads bool) CreateTokenOption

WithCanReadAllFileUploads allows access to all file uploads. Without this permission, only files uplaoded using the new token are accessible.

func WithComponentAccess

func WithComponentAccess(component string) CreateTokenOption

WithComponentAccess adds `component` to the list of components this token may access.

func WithDescription

func WithDescription(description string) CreateTokenOption

WithDescription sets the token's description.

func WithExpiresIn

func WithExpiresIn(expiresIn time.Duration) CreateTokenOption

WithExpiresIn sets the time until the token expires.

type CreateWorkspaceOption

type CreateWorkspaceOption func(p *params)

func WithExpireAfterHours

func WithExpireAfterHours(v uint64) CreateWorkspaceOption

func WithImageVersion

func WithImageVersion(v string) CreateWorkspaceOption

func WithShared

func WithShared(v bool) CreateWorkspaceOption

func WithSize

func WithSize(v string) CreateWorkspaceOption

type CreatorToken

type CreatorToken struct {
	ID          int    `json:"id"`
	Description string `json:"description"`
}

type DataType added in v1.7.0

type DataType string
const (
	// For numbers without a decimal point (Snowflake, Teradata, Bigquery).
	TypeInteger DataType = "INTEGER"
	// For number with a decimal point (Snowflake, Bigquery).
	TypeDouble DataType = "DOUBLE"
	// For number without a decimal point (Synapse, Bigquery).
	TypeBigInt DataType = "BIGINT"
	// For number with a decimal point (Synapse, Teradata, Bigquery).
	TypeReal DataType = "REAL"
	// For numbers (Exasol, Bigquery).
	TypeDecimal DataType = "DECIMAL"
)

func ParseDataType added in v1.7.0

func ParseDataType(s string) (DataType, error)

ParseDataType parses a numeric data type from a string.

Available data types:

 type    | constant name
---------|---------------
 INTEGER | TypeInteger
 DOUBLE  | TypeDouble
 BIGINT  | TypeBigInt
 REAL    | TypeReal
 DECIMAL | TypeDecimal

If you know the data type ahead of time, you can use the associated constant instead of parsing it from a string.

type DeleteOption

type DeleteOption func(c *deleteConfig)

DeleteOption for requests to delete bucket or table.

func WithForce

func WithForce() DeleteOption

type DownloadOption added in v1.4.0

type DownloadOption func(c *downloadConfig)

func WithDownloadTransport added in v1.4.0

func WithDownloadTransport(transport http.RoundTripper) DownloadOption

type DurationSeconds

type DurationSeconds time.Duration

DurationSeconds is time.Duration encoded/decoded as number of seconds.

func (DurationSeconds) MarshalJSON

func (d DurationSeconds) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding.

func (DurationSeconds) String

func (d DurationSeconds) String() string

func (*DurationSeconds) UnmarshalJSON

func (d *DurationSeconds) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding.

type EncryptionError

type EncryptionError struct {
	Message     string `json:"error"`
	ErrCode     int    `json:"code"`
	ExceptionID string `json:"exceptionId"`
	// contains filtered or unexported fields
}

EncryptionError represents the structure Encryption API error.

func (*EncryptionError) Error

func (e *EncryptionError) Error() string

func (*EncryptionError) ErrorExceptionID

func (e *EncryptionError) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (*EncryptionError) ErrorName

func (e *EncryptionError) ErrorName() string

ErrorName returns a human-readable name of the error.

func (*EncryptionError) ErrorUserMessage

func (e *EncryptionError) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*EncryptionError) SetRequest

func (e *EncryptionError) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*EncryptionError) SetResponse

func (e *EncryptionError) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (*EncryptionError) StatusCode

func (e *EncryptionError) StatusCode() int

StatusCode returns HTTP status code.

type Event

type Event struct {
	ID          EventID                `json:"id" readonly:"true"`
	ComponentID ComponentID            `json:"component"`
	Message     string                 `json:"message"`
	Type        string                 `json:"type"`
	Duration    client.DurationSeconds `json:"duration"`
	Params      JSONString             `json:"params"`
	Results     JSONString             `json:"results"`
}

Event https://keboola.docs.apiary.io/#reference/events/events/create-event

type EventID

type EventID string

EventID represents an ID of an event in Storage API.

func (EventID) String

func (v EventID) String() string

type Features

type Features []string

func (Features) ToMap

func (v Features) ToMap() FeaturesMap

ToMap converts Features slice to FeaturesMap.

type FeaturesMap

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

FeaturesMap is immutable map of features, see Features.ToMap.

func (FeaturesMap) Has

func (m FeaturesMap) Has(feature string) bool

Has returns true if project has the feature enabled.

func (FeaturesMap) ToSlice added in v1.26.0

func (m FeaturesMap) ToSlice() Features

ToSlice converts FeatureMap to Features slice.

type File

type File struct {
	FileKey
	Created         iso8601.Time `json:"created" readonly:"true"`
	IsSliced        bool         `json:"isSliced,omitempty"`
	IsEncrypted     bool         `json:"isEncrypted,omitempty"`
	Name            string       `json:"name"`
	URL             string       `json:"url" readonly:"true"`
	Provider        string       `json:"provider" readonly:"true"`
	Region          string       `json:"region" readonly:"true"`
	SizeBytes       uint64       `json:"sizeBytes,omitempty"`
	Tags            []string     `json:"tags,omitempty"`
	MaxAgeDays      uint         `json:"maxAgeDays" readonly:"true"`
	ContentType     string       `json:"contentType,omitempty"`
	FederationToken bool         `json:"federationToken,omitempty"`
	IsPermanent     bool         `json:"isPermanent,omitempty"`
	Notify          bool         `json:"notify,omitempty"`
}

type FileAttributes added in v1.8.0

type FileAttributes struct {
	ContentType string
	ModTime     time.Time
	Size        int64
}

func GetFileAttributes added in v1.8.0

func GetFileAttributes(ctx context.Context, file *FileDownloadCredentials, slice string, opts ...DownloadOption) (*FileAttributes, error)

type FileDownloadCredentials added in v1.4.0

type FileDownloadCredentials struct {
	File
	*S3DownloadParams
	*ABSDownloadParams
	*GCSDownloadParams
}

func (*FileDownloadCredentials) DestinationURL added in v1.6.0

func (f *FileDownloadCredentials) DestinationURL() (string, error)

type FileID added in v1.17.0

type FileID int

func (FileID) String added in v1.17.0

func (v FileID) String() string

type FileKey added in v1.17.0

type FileKey struct {
	BranchID BranchID `json:"-"`
	FileID   FileID   `json:"id" readonly:"true"`
}

type FileUploadCredentials added in v1.4.0

type FileUploadCredentials struct {
	File
	ABSUploadParams *abs.UploadParams `json:"absUploadParams,omitempty"`
	GCSUploadParams *gcs.UploadParams `json:"gcsUploadParams,omitempty"`
	S3UploadParams  *s3.UploadParams  `json:"uploadParams,omitempty"`
}

func (*FileUploadCredentials) CredentialsExpiration added in v1.16.7

func (v *FileUploadCredentials) CredentialsExpiration() time.Time

type GCSDownloadParams added in v1.4.0

type GCSDownloadParams = gcs.DownloadParams

type GetOldQueueJobOption added in v1.3.0

type GetOldQueueJobOption func(c *getOldQueueJobConfig)

func WithMetrics added in v1.3.0

func WithMetrics() GetOldQueueJobOption

type Index

type Index struct {
	Services Services `json:"services"`
	Features Features `json:"features"`
}

Index of Storage API.

func APIIndex

func APIIndex(ctx context.Context, host string, opts ...APIOption) (*Index, error)

func (Index) AllServices

func (i Index) AllServices() ServicesMap

AllServices converts services slice to map.

func (Index) ServiceURLByID

func (i Index) ServiceURLByID(serviceID ServiceID) (ServiceURL, bool)

ServiceURLByID return service URL by service ID.

type IndexComponents

type IndexComponents struct {
	Index
	Components Components `json:"components"`
}

IndexComponents is the Index of Storage API with components included.

func APIIndexWithComponents

func APIIndexWithComponents(ctx context.Context, host string, opts ...APIOption) (*IndexComponents, error)

type JSONString

type JSONString map[string]any

JSONString is Json encoded as string, see CreateEventRequest.

func (*JSONString) MarshalJSON

func (v *JSONString) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding.

func (JSONString) String

func (v JSONString) String() string

func (*JSONString) UnmarshalJSON

func (v *JSONString) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding.

type JobBackendSize added in v1.5.0

type JobBackendSize string
const (
	JobBackendXSmall JobBackendSize = "xsmall"
	JobBackendSmall  JobBackendSize = "small"
	JobBackendMedium JobBackendSize = "medium"
	JobBackendLarge  JobBackendSize = "large"
)

type JobDetail added in v1.3.0

type JobDetail struct {
	ID              JobID                  `json:"id"`
	RunID           string                 `json:"runId"`
	LockName        string                 `json:"lockName"`
	Project         ProjectDetail          `json:"project"`
	Token           TokenDetail            `json:"token"`
	Component       ComponentID            `json:"component"`
	Command         string                 `json:"command"`
	Params          *orderedmap.OrderedMap `json:"params"`
	Result          OldQueueJobResult      `json:"result"`
	Status          string                 `json:"status"`
	Process         ProcessDetail          `json:"process"`
	CreatedTime     iso8601.Time           `json:"createdTime"`
	StartTime       *iso8601.Time          `json:"startTime"`
	EndTime         *iso8601.Time          `json:"endTime"`
	DurationSeconds uint64                 `json:"durationSeconds"`
	WaitSeconds     uint64                 `json:"waitSeconds"`
	Metrics         *JobMetrics            `json:"metrics"`
}

type JobID

type JobID string

JobID is an ID of a component job.

func (JobID) String

func (j JobID) String() string

func (*JobID) UnmarshalJSON added in v1.3.0

func (j *JobID) UnmarshalJSON(b []byte) error

type JobKey

type JobKey struct {
	ID JobID `json:"id"`
}

JobKey is a unique identifier of QueueJob.

type JobMetrics added in v1.3.0

type JobMetrics struct {
	Network NetworkMetrics `json:"network"`
	Storage StorageMetrics `json:"storage"`
	Backend string         `json:"backend"`
}

type JobMode added in v1.5.0

type JobMode string
const (
	JobModeRun      JobMode = "run"      // JobModeRun is the default mode, runs the job as usual.
	JobModeDebug    JobMode = "debug"    // JobModeDebug outputs a snapshot of configuration and a snapshot of output as storage files, but does not perform output mapping to storage.
	JobModeForceRun JobMode = "forceRun" // JobModeForceRun forces a configuration to run even if it is disabled.
)

type JobResult

type JobResult struct {
	Error   map[string]any `json:"error,omitempty"`
	Message string         `json:"message,omitempty"`
}

func (*JobResult) UnmarshalJSON

func (r *JobResult) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding.

type ListBucketsOption

type ListBucketsOption func(c *listBucketsConfig)

type ListTableOption added in v1.17.0

type ListTableOption func(c *listTablesConfig)

func WithBuckets

func WithBuckets() ListTableOption

func WithColumnMetadata

func WithColumnMetadata() ListTableOption

func WithColumns

func WithColumns() ListTableOption

func WithMetadata

func WithMetadata() ListTableOption

type LoadDataOption

type LoadDataOption interface {
	// contains filtered or unexported methods
}

LoadDataOption applies to the request loading data to a table.

type Metadata

type Metadata map[string]string

Metadata - object metadata.

func (Metadata) ToPayload added in v1.23.0

func (m Metadata) ToPayload() (payload MetadataPayload)

type MetadataDetail

type MetadataDetail struct {
	ID        string `json:"id"`
	Key       string `json:"key"`
	Value     string `json:"value"`
	Timestamp string `json:"timestamp"`
	Provider  string `json:"provider"`
}

MetadataDetail - metadata with details (id, timestamp).

type MetadataDetails

type MetadataDetails []MetadataDetail

MetadataDetails - metadata with details (id, timestamp).

func (MetadataDetails) ToMap

func (v MetadataDetails) ToMap() Metadata

ToMap converts slice to map.

type MetadataKV added in v1.23.0

type MetadataKV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type MetadataPayload added in v1.23.0

type MetadataPayload struct {
	Metadata []MetadataKV `json:"metadata"`
}

type NetworkMetrics added in v1.3.0

type NetworkMetrics struct {
	InBytes  uint64 `json:"inBytes"`
	OutBytes uint64 `json:"outBytes"`
}

type Object

type Object interface {
	ObjectID() any
}

type OldQueueJobOption added in v1.3.0

type OldQueueJobOption func(c *oldQueueJobConfig)

func WithBranchID added in v1.3.0

func WithBranchID(id BranchID) OldQueueJobOption

func WithConfigData added in v1.3.0

func WithConfigData(configData map[string]any) OldQueueJobOption

func WithImageTag added in v1.3.0

func WithImageTag(tag string) OldQueueJobOption

func WithRowID added in v1.3.0

func WithRowID(id RowID) OldQueueJobOption

func WithVariableValuesData added in v1.3.0

func WithVariableValuesData(data VariableValuesData) OldQueueJobOption

func WithVariableValuesID added in v1.3.0

func WithVariableValuesID(id string) OldQueueJobOption

type OldQueueJobResult added in v1.3.0

type OldQueueJobResult struct {
	ExceptionID string `json:"exceptionId"`
	Message     string `json:"message"`
}

type PreviewOption added in v1.1.0

type PreviewOption interface {
	// contains filtered or unexported methods
}

type ProcessDetail added in v1.3.0

type ProcessDetail struct {
	Host string `json:"host"`
	PID  int    `json:"pid"`
}

type ProjectDetail added in v1.3.0

type ProjectDetail struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type ProjectID added in v1.9.0

type ProjectID int

func (ProjectID) String added in v1.14.0

func (v ProjectID) String() string

type PublicAPI added in v1.19.0

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

func NewPublicAPI added in v1.19.0

func NewPublicAPI(ctx context.Context, host string, opts ...APIOption) (*PublicAPI, error)

func NewPublicAPIFromIndex added in v1.19.0

func NewPublicAPIFromIndex(host string, index *Index, opts ...APIOption) *PublicAPI
Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/keboola/go-client/pkg/keboola"
)

func main() {
	ctx := context.TODO()
	host := "connection.keboola.com"

	// Load services list
	index, err := keboola.APIIndex(ctx, host)
	if err != nil {
		log.Fatal(err)
	}

	// Create API
	publicAPI := keboola.NewPublicAPIFromIndex(host, index)

	// Authorize
	api := publicAPI.WithToken("<my-token>")

	// Get default branch
	defaultBranch, err := api.GetDefaultBranchRequest().Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	// Send request
	buckets, err := api.ListBucketsRequest(defaultBranch.ID).Send(ctx)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%#v", buckets)
}
Output:

func (*PublicAPI) Client added in v1.19.0

func (a *PublicAPI) Client() request.Sender

func (*PublicAPI) EncryptRequest added in v1.19.0

func (a *PublicAPI) EncryptRequest(projectID int, componentID ComponentID, data map[string]string) request.APIRequest[*map[string]string]

EncryptRequest - https://keboolaencryption.docs.apiary.io/#reference/encrypt/encryption/encrypt-data

func (*PublicAPI) Index added in v1.19.0

func (a *PublicAPI) Index() *Index

func (*PublicAPI) IndexComponentsRequest added in v1.19.0

func (a *PublicAPI) IndexComponentsRequest() request.APIRequest[*IndexComponents]

IndexComponentsRequest returns index of Storage API with components definitions.

func (*PublicAPI) IndexRequest added in v1.19.0

func (a *PublicAPI) IndexRequest() request.APIRequest[*Index]

IndexRequest returns index of Storage API without components definitions.

func (*PublicAPI) WithToken added in v1.19.0

func (a *PublicAPI) WithToken(token string) *AuthorizedAPI

WithToken returns a new authorized instance of the API.

type QueueError

type QueueError struct {
	Message     string `json:"error"`
	ErrCode     int    `json:"code"`
	ExceptionID string `json:"exceptionId"`
	// contains filtered or unexported fields
}

QueueError represents the structure of Jobs Queue API error.

func (*QueueError) Error

func (e *QueueError) Error() string

func (*QueueError) ErrorExceptionID

func (e *QueueError) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (*QueueError) ErrorName

func (e *QueueError) ErrorName() string

ErrorName returns a human-readable name of the error.

func (*QueueError) ErrorUserMessage

func (e *QueueError) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*QueueError) SetRequest

func (e *QueueError) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*QueueError) SetResponse

func (e *QueueError) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (*QueueError) StatusCode

func (e *QueueError) StatusCode() int

StatusCode returns HTTP status code.

type QueueJob

type QueueJob struct {
	JobKey
	Status     string        `json:"status"`
	IsFinished bool          `json:"isFinished"`
	URL        string        `json:"url"`
	Result     JobResult     `json:"result,omitempty"`
	CreateTime iso8601.Time  `json:"createdTime"`
	StartTime  *iso8601.Time `json:"startTime"`
	EndTime    *iso8601.Time `json:"endTime"`
}

QueueJob is a component job.

type Range added in v1.26.2

type Range struct {
	Start    string `json:"start"`
	End      string `json:"end"`
	Interval string `json:"interval"`
}

type RangePartitioning added in v1.26.2

type RangePartitioning struct {
	Field string `json:"field"`
	Range Range  `json:"range"`
}

type RowID

type RowID string

RowID is id of configuration row.

func (RowID) String

func (v RowID) String() string

type S3DownloadParams added in v1.4.0

type S3DownloadParams = s3.DownloadParams

type Schedule

type Schedule struct {
	ScheduleKey
	ConfigID ConfigID `json:"configurationId"`
}

Schedule - https://app.swaggerhub.com/apis/odinuv/scheduler/1.0.0#/schedules/get_schedules

type ScheduleID

type ScheduleID string

ScheduleID is ID of a schedule in Scheduler API.

func (ScheduleID) String

func (v ScheduleID) String() string

type ScheduleKey

type ScheduleKey struct {
	ID ScheduleID `json:"id" validate:"required"`
}

ScheduleKey is a unique identifier of a schedule.

type SchedulerError

type SchedulerError struct {
	Message     string `json:"error"`
	ErrCode     int    `json:"code"`
	ExceptionID string `json:"exceptionId"`
	// contains filtered or unexported fields
}

SchedulerError represents the structure Scheduler API error.

func (*SchedulerError) Error

func (e *SchedulerError) Error() string

func (*SchedulerError) ErrorExceptionID

func (e *SchedulerError) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (*SchedulerError) ErrorName

func (e *SchedulerError) ErrorName() string

ErrorName returns a human-readable name of the error.

func (*SchedulerError) ErrorUserMessage

func (e *SchedulerError) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*SchedulerError) SetRequest

func (e *SchedulerError) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*SchedulerError) SetResponse

func (e *SchedulerError) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (*SchedulerError) StatusCode

func (e *SchedulerError) StatusCode() int

StatusCode returns HTTP status code.

type Service

type Service struct {
	ID  ServiceID  `json:"id"`
	URL ServiceURL `json:"url"`
}

Service is a Keboola service, for example Encryption API.

type ServiceID

type ServiceID string

ServiceID is an ID of a Keboola service, for example "encryption".

func (ServiceID) String

func (u ServiceID) String() string

type ServiceType

type ServiceType string

type ServiceURL

type ServiceURL string

ServiceURL is an url of a Keboola service, for example "https://encryption.keboola.com".

func (ServiceURL) String

func (u ServiceURL) String() string

type Services

type Services []*Service

Services slice.

func (Services) ToMap

func (v Services) ToMap() ServicesMap

ToMap converts Services slice to ServicesMap.

type ServicesMap

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

ServicesMap is immutable map of services, see Services.ToMap.

func (ServicesMap) Len

func (m ServicesMap) Len() int

Len return length of services map.

func (ServicesMap) URLByID

func (m ServicesMap) URLByID(serviceID ServiceID) (ServiceURL, bool)

URLByID return service URL by service ID.

type Slice

type Slice struct {
	URL string `json:"url"`
}

type SlicedFileManifest

type SlicedFileManifest struct {
	Entries []Slice `json:"entries"`
}

func NewSlicedFileManifest

func NewSlicedFileManifest(file *FileUploadCredentials, sliceNames []string) (*SlicedFileManifest, error)

type SlicesList added in v1.6.0

type SlicesList []string

func DownloadManifest added in v1.4.0

func DownloadManifest(ctx context.Context, file *FileDownloadCredentials) (SlicesList, error)

type SourceProject added in v1.9.0

type SourceProject struct {
	ID   ProjectID `json:"id"`
	Name string    `json:"name"`
}

type SourceTable added in v1.9.0

type SourceTable struct {
	ID      TableID       `json:"id"`
	URI     string        `json:"uri"`
	Name    string        `json:"name"`
	Project SourceProject `json:"project"`
}

type StorageError

type StorageError struct {
	Message     string `json:"error"`
	ErrCode     string `json:"code"`
	ExceptionID string `json:"exceptionId"`
	// contains filtered or unexported fields
}

StorageError represents the structure of Storage API error.

func (*StorageError) Error

func (e *StorageError) Error() string

func (*StorageError) ErrorExceptionID

func (e *StorageError) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (*StorageError) ErrorName

func (e *StorageError) ErrorName() string

ErrorName returns a human-readable name of the error.

func (*StorageError) ErrorUserMessage

func (e *StorageError) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*StorageError) SetRequest

func (e *StorageError) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*StorageError) SetResponse

func (e *StorageError) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (*StorageError) StatusCode

func (e *StorageError) StatusCode() int

StatusCode returns HTTP status code.

type StorageJob

type StorageJob struct {
	StorageJobKey
	Status          string           `json:"status"`
	URL             string           `json:"url"`
	OperationName   string           `json:"operationName"`
	OperationParams map[string]any   `json:"operationParams"`
	Results         StorageJobResult `json:"results,omitempty"`
	CreateTime      iso8601.Time     `json:"createdTime"`
	StartTime       *iso8601.Time    `json:"startTime"`
	EndTime         *iso8601.Time    `json:"endTime"`
	Error           *StorageJobError `json:"error,omitempty"`
}

StorageJob is a storage job.

type StorageJobError

type StorageJobError struct {
	Code        string `json:"code"`
	Message     string `json:"message"`
	ExceptionID string `json:"exceptionId"`
}

type StorageJobID

type StorageJobID int

StorageJobID is an ID of a storage job.

func (StorageJobID) String

func (id StorageJobID) String() string

type StorageJobKey

type StorageJobKey struct {
	ID StorageJobID `json:"id"`
}

StorageJobKey is a unique identifier of StorageJob.

type StorageJobResult

type StorageJobResult map[string]any

func (*StorageJobResult) UnmarshalJSON

func (r *StorageJobResult) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding. The API returns empty array when the results field is empty.

type StorageMetrics added in v1.3.0

type StorageMetrics struct {
	InBytes  uint64 `json:"inBytes"`
	OutBytes uint64 `json:"outBytes"`
}

type Table

type Table struct {
	TableKey
	URI            string           `json:"uri"`
	Name           string           `json:"name"`
	DisplayName    string           `json:"displayName"`
	SourceTable    *SourceTable     `json:"sourceTable"`
	PrimaryKey     []string         `json:"primaryKey"`
	Created        iso8601.Time     `json:"created"`
	LastImportDate iso8601.Time     `json:"lastImportDate"`
	LastChangeDate *iso8601.Time    `json:"lastChangeDate"`
	Definition     *TableDefinition `json:"definition,omitempty"`
	RowsCount      uint64           `json:"rowsCount"`
	DataSizeBytes  uint64           `json:"dataSizeBytes"`
	Columns        []string         `json:"columns"`
	Metadata       TableMetadata    `json:"metadata"`
	ColumnMetadata ColumnsMetadata  `json:"columnMetadata"`
	Bucket         *Bucket          `json:"bucket"`
}

Table https://keboola.docs.apiary.io/#reference/tables/list-tables/list-all-tables

type TableDefinition added in v1.20.0

type TableDefinition struct {
	PrimaryKeyNames   []string           `json:"primaryKeysNames"`
	Columns           Columns            `json:"columns"`
	TimePartitioning  *TimePartitioning  `json:"timePartitioning,omitempty"`
	RangePartitioning *RangePartitioning `json:"rangePartitioning,omitempty"`
	Clustering        *Clustering        `json:"clustering,omitempty"`
}

type TableID

type TableID struct {
	BucketID
	TableName string `validate:"required,min=1,max=96"`
}

func MustParseTableID

func MustParseTableID(v string) TableID

func ParseTableID

func ParseTableID(v string) (TableID, error)

func (TableID) MarshalJSON

func (v TableID) MarshalJSON() ([]byte, error)

func (TableID) String

func (v TableID) String() string

func (*TableID) UnmarshalJSON

func (v *TableID) UnmarshalJSON(data []byte) error

type TableKey added in v1.17.0

type TableKey struct {
	BranchID BranchID `json:"-"`
	TableID  TableID  `json:"id"`
}

func (TableKey) BucketKey added in v1.19.0

func (v TableKey) BucketKey() BucketKey

func (TableKey) String added in v1.21.0

func (v TableKey) String() string

type TableMetadata added in v1.16.5

type TableMetadata []MetadataDetail

type TableMetadataRequest added in v1.16.5

type TableMetadataRequest struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type TableMetadataResponse added in v1.16.5

type TableMetadataResponse struct {
	Metadata       TableMetadata   `json:"metadata"`
	ColumnMetadata ColumnsMetadata `json:"columnsMetadata"`
}

TableMetadataResponse https://keboola.docs.apiary.io/#reference/metadata/table-metadata/create-or-update

type TablePreview added in v1.1.0

type TablePreview struct {
	Columns []string
	Rows    [][]string
}

type TableUnloadJobResult added in v1.12.0

type TableUnloadJobResult struct {
	File     UnloadedFile `json:"file"`
	CacheHit bool         `json:"cacheHit"`
}

type TableUnloadRequestBuilder added in v1.12.0

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

func (*TableUnloadRequestBuilder) Build added in v1.12.0

func (*TableUnloadRequestBuilder) Send added in v1.12.0

func (*TableUnloadRequestBuilder) SendAndWait added in v1.12.0

SendAndWait the request and wait for the resulting storage job to finish. Once the job finishes, this returns its `results` object, which contains the created file ID.

func (*TableUnloadRequestBuilder) WithChangedSince added in v1.12.0

WithChangedSince sets filtering by import date - timestamp of import is stored within each row. Can be a unix timestamp or any date accepted by strtotime (https://www.php.net/manual/en/function.strtotime.php).

func (*TableUnloadRequestBuilder) WithChangedUntil added in v1.12.0

WithChangedUntil sets filtering by import date - timestamp of import is stored within each row. Can be a unix timestamp or any date accepted by strtotime (https://www.php.net/manual/en/function.strtotime.php).

func (*TableUnloadRequestBuilder) WithColumns added in v1.12.0

WithColumns sets list of columns to export. By default, all columns are exported.

func (*TableUnloadRequestBuilder) WithFormat added in v1.12.0

WithFormat the output file format. JSON format is only supported in projects with the Snowflake backend.

func (*TableUnloadRequestBuilder) WithLimitRows added in v1.12.0

WithLimitRows the number of returned rows. Maximum allowed value is 1000. Default value is 100.

func (*TableUnloadRequestBuilder) WithOrderBy added in v1.12.0

func (b *TableUnloadRequestBuilder) WithOrderBy(column string, order ColumnOrder, ty ...DataType) *TableUnloadRequestBuilder

func (*TableUnloadRequestBuilder) WithWhere added in v1.12.0

func (b *TableUnloadRequestBuilder) WithWhere(column string, op CompareOp, values []string, ty ...DataType) *TableUnloadRequestBuilder

WithWhere sets a where condition. If the column contains a numeric type, `ty` may be used to specify the exact type. `ty` should be exactly one value, or empty.

type TicketProvider

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

TicketProvider generates new IDs and GUARANTEES that the IDs will be returned with the same order as the Request method was called.

func NewTicketProvider

func NewTicketProvider(ctx context.Context, api *AuthorizedAPI) *TicketProvider

NewTicketProvider creates TicketProvider.

func (*TicketProvider) Request

func (t *TicketProvider) Request(onSuccess func(ticket *Ticket))

Request queues ID generation requests and registers callback.

func (*TicketProvider) Resolve

func (t *TicketProvider) Resolve() error

Resolve sends all ID generation requests and then calls all callbacks.

type TimePartitioning added in v1.26.2

type TimePartitioning struct {
	Type         TimePartitioningType `json:"type"`
	ExpirationMs string               `json:"expirationMs,omitempty"`
	Field        string               `json:"field,omitempty"`
}

type TimePartitioningType added in v1.26.2

type TimePartitioningType string
const (
	Day   TimePartitioningType = "DAY"
	Hour  TimePartitioningType = "HOUR"
	Month TimePartitioningType = "MONTH"
	Year  TimePartitioningType = "YEAR"
)

func (TimePartitioningType) String added in v1.26.2

func (t TimePartitioningType) String() string

type Token

type Token struct {
	Token                 string            `json:"token"` // set manually from request
	ID                    string            `json:"id"`
	Description           string            `json:"description"`
	IsMaster              bool              `json:"isMasterToken"`
	CanManageBuckets      bool              `json:"canManageBuckets"`
	CanManageTokens       bool              `json:"canManageTokens"`
	CanReadAllFileUploads bool              `json:"canReadAllFileUploads"`
	CanPurgeTrash         bool              `json:"canPurgeTrash"`
	Created               iso8601.Time      `json:"created"`
	Refreshed             iso8601.Time      `json:"refreshed"`
	Expires               *iso8601.Time     `json:"expires"`
	IsExpired             bool              `json:"isExpired"`
	IsDisabled            bool              `json:"isDisabled"`
	Owner                 TokenOwner        `json:"owner"`
	Admin                 *TokenAdmin       `json:"admin,omitempty"`
	Creator               *CreatorToken     `json:"creatorToken,omitempty"`
	BucketPermissions     BucketPermissions `json:"bucketPermissions,omitempty"`
	ComponentAccess       []string          `json:"componentAccess,omitempty"`
}

Token https://keboola.docs.apiary.io/#reference/tokens-and-permissions/token-verification/token-verification

func (*Token) ProjectID

func (t *Token) ProjectID() int

ProjectID returns ID of project to which the token belongs.

func (*Token) ProjectName

func (t *Token) ProjectName() string

ProjectName returns name of project to which the token belongs.

type TokenAdmin

type TokenAdmin struct {
	Name                 string   `json:"name"`
	ID                   int      `json:"id"`
	IsOrganizationMember bool     `json:"isOrganizationMember"`
	Role                 string   `json:"role"`
	Features             Features `json:"features"`
}

TokenAdmin - admin part of the token that should exist if the token is a master token.

type TokenDetail added in v1.3.0

type TokenDetail struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

type TokenOwner

type TokenOwner struct {
	ID             int      `json:"id"`
	Name           string   `json:"name"`
	Features       Features `json:"features"`
	HasMysql       bool     `json:"hasMysql"`
	HasSynapse     bool     `json:"hasSynapse"`
	HasRedshift    bool     `json:"hasRedshift"`
	HasSnowflake   bool     `json:"hasSnowflake"`
	HasExasol      bool     `json:"hasExasol"`
	HasTeradata    bool     `json:"hasTeradata"`
	HasBigquery    bool     `json:"hasBigquery"`
	DefaultBackend string   `json:"defaultBackend"`
}

TokenOwner - owner of Token.

type UnloadFormat added in v1.12.0

type UnloadFormat string
const (
	// UnloadFormatCSV generates CSV formatted according to RFC4180. This is the default format.
	UnloadFormatCSV UnloadFormat = "rfc"
	// UnloadFormatJSON is only supported in projects with the Snowflake backend.
	UnloadFormatJSON UnloadFormat = "json"
)

type UnloadedFile added in v1.12.0

type UnloadedFile struct {
	FileKey
}

type UploadOption added in v1.4.0

type UploadOption func(c *uploadConfig)

func WithUploadTransport

func WithUploadTransport(transport http.RoundTripper) UploadOption

type VariableData added in v1.3.0

type VariableData struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type VariableValuesData added in v1.3.0

type VariableValuesData struct {
	Values []VariableData `json:"values"`
}

type Workspace

type Workspace struct {
	ID       WorkspaceID    `json:"id"`
	Type     string         `json:"type"`
	Size     string         `json:"size"` // Only exists for container workspaces (Python, R)
	Active   bool           `json:"active"`
	Shared   bool           `json:"shared"`
	User     string         `json:"user"`
	Host     string         `json:"host"`
	URL      string         `json:"url"`
	Password string         `json:"password"`
	Created  WorkspacesTime `json:"createdTimestamp"`
	Updated  WorkspacesTime `json:"updatedTimestamp"`
	Start    WorkspacesTime `json:"startTimestamp"`
	// Workspace details - only exists for Snowflake workspaces
	Details *WorkspaceDetails `json:"workspaceDetails"`
}

type WorkspaceDetails

type WorkspaceDetails struct {
	Connection struct {
		Database  string `json:"database"`
		Schema    string `json:"schema"`
		Warehouse string `json:"warehouse"`
	} `json:"connection"`
}

type WorkspaceID

type WorkspaceID string

func GetWorkspaceID

func GetWorkspaceID(c *Config) (WorkspaceID, error)

func (WorkspaceID) String

func (v WorkspaceID) String() string

type WorkspaceWithConfig

type WorkspaceWithConfig struct {
	Workspace *Workspace
	Config    *Config
}

func (WorkspaceWithConfig) String

func (v WorkspaceWithConfig) String() string

type WorkspacesError

type WorkspacesError struct {
	Message   string `json:"message"`
	ErrorInfo string `json:"error"`
	// contains filtered or unexported fields
}

WorkspacesError represents the structure of Workspaces API error.

func (*WorkspacesError) Error

func (e *WorkspacesError) Error() string

func (*WorkspacesError) ErrorName

func (e *WorkspacesError) ErrorName() string

ErrorName returns a human-readable name of the error.

func (*WorkspacesError) ErrorUserMessage

func (e *WorkspacesError) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*WorkspacesError) SetRequest

func (e *WorkspacesError) SetRequest(request *http.Request)

SetRequest method allows injection of HTTP request to the error, it implements client.errorWithRequest.

func (*WorkspacesError) SetResponse

func (e *WorkspacesError) SetResponse(response *http.Response)

SetResponse method allows injection of HTTP response to the error, it implements client.errorWithResponse.

func (*WorkspacesError) StatusCode

func (e *WorkspacesError) StatusCode() int

StatusCode returns HTTP status code.

type WorkspacesTime

type WorkspacesTime time.Time

WorkspacesTime is encoded/decoded in TimeFormat used in Workspaces API.

func (WorkspacesTime) MarshalJSON

func (t WorkspacesTime) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding.

func (WorkspacesTime) String

func (t WorkspacesTime) String() string

func (*WorkspacesTime) UnmarshalJSON

func (t *WorkspacesTime) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements JSON decoding.

Directories

Path Synopsis
storage_file_upload
abs
gcs
s3

Jump to

Keyboard shortcuts

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