keboola

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 27 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.

Contains request definitions for the Encryption API. Requests can be sent by any HTTP client that implements the client.Sender interface.

Contains request definitions for the Jobs Queue API. Requests can be sent by any HTTP client that implements the client.Sender interface.

nolint: dupl

Contains request definitions for the Scheduler API. 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.

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
	api := keboola.NewAPIFromIndex(host, &index.Index, keboola.WithToken("<my-token>"))

	// Send request
	buckets, err := api.ListBucketsRequest().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")
	TransformationType       = "transformation"
	DeprecatedFlag           = `deprecated`
	ExcludeFromNewListFlag   = `excludeFromNewList`
	GenericCodeBlocksUIFlag  = `genericCodeBlocksUI`
	ComponentTypeCodePattern = `code-pattern`
	ComponentTypeProcessor   = `processor`
)

Component constants.

View Source
const (
	OrderAsc  order = "ASC"
	OrderDesc order = "DESC"
)
View Source
const (
	CompareEq compareOp = "eq"
	CompareNe compareOp = "ne"
	CompareGt compareOp = "gt"
	CompareGe compareOp = "ge"
	CompareLt compareOp = "lt"
	CompareLe compareOp = "le"
)
View Source
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"
)
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 *API,
) 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 order, ty ...dataType) *orderByBuilder

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(column string, op compareOp, values []any, ty ...dataType) *whereFilterBuilder

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 API

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

func APIClientForAnEmptyProject

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

func APIClientForRandomProject

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

func NewAPI

func NewAPI(ctx context.Context, host string, opts ...APIOption) (*API, error)
Example
package main

import (
	"context"
	"fmt"
	"log"

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

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

	// Create API
	api, err := keboola.NewAPI(ctx, host, keboola.WithToken("<my-token>"))
	if err != nil {
		log.Fatal(err)
	}

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

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

func NewAPIFromIndex

func NewAPIFromIndex(host string, index *Index, opts ...APIOption) *API
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, keboola.WithToken("<my-token>"))
	if err != nil {
		log.Fatal(err)
	}

	// Create API
	api := keboola.NewAPIFromIndex(host, index)

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

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

func (*API) ActivateScheduleRequest

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

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

func (*API) AppendMetadataRequest

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

AppendMetadataRequest creates request to append object metadata according its type.

func (*API) CleanAllSchedulesRequest

func (a *API) CleanAllSchedulesRequest() client.APIRequest[client.NoResult]

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

func (*API) CleanProjectRequest

func (a *API) CleanProjectRequest() client.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 (*API) CleanWorkspaceInstances

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

func (*API) Client

func (a *API) Client() client.Sender

func (*API) CreateEventRequest

func (a *API) CreateEventRequest(event *Event) client.APIRequest[*Event]

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

func (*API) CreateOldQueueJobRequest deprecated added in v1.3.0

func (a *API) CreateOldQueueJobRequest(
	componentID ComponentID,
	configID ConfigID,
	opts ...OldQueueJobOption,
) client.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 (*API) CreateQueueJobConfigDataRequest deprecated

func (a *API) CreateQueueJobConfigDataRequest(componentID ComponentID, configID ConfigID, configData map[string]any) client.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 (*API) CreateQueueJobRequest deprecated

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

Deprecated: Use `NewCreateJobRequest` instead.

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

func (*API) CreateRequest

func (a *API) CreateRequest(object Object) client.APIRequest[Object]

CreateRequest creates request to create object according its type.

func (*API) CreateTableRequest added in v1.3.0

func (a *API) CreateTableRequest(tableID TableID, columns []string, opts ...CreateTableOption) client.APIRequest[*Table]

CreateTableRequest creates an empty table with given columns.

func (*API) CreateWorkspace

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

func (*API) CreateWorkspaceConfigRequest

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

func (*API) CreateWorkspaceJobRequest

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

func (*API) DeleteBucketAsyncRequest added in v1.1.0

func (a *API) DeleteBucketAsyncRequest(bucketID BucketID, opts ...DeleteOption) client.APIRequest[*StorageJob]

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

func (*API) DeleteConfigsInBranchRequest

func (a *API) DeleteConfigsInBranchRequest(branch BranchKey) client.APIRequest[client.NoResult]

DeleteConfigsInBranchRequest lists all configs in branch and deletes them all.

func (*API) DeleteMetadataRequest

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

DeleteMetadataRequest creates request to delete object metadata according its type.

func (*API) DeleteRequest

func (a *API) DeleteRequest(key any) client.APIRequest[client.NoResult]

DeleteRequest creates request to delete object according its type.

func (*API) DeleteSchedulesForConfigurationRequest

func (a *API) DeleteSchedulesForConfigurationRequest(configID ConfigID) client.APIRequest[client.NoResult]

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

func (*API) DeleteTokenRequest

func (a *API) DeleteTokenRequest(tokenID string) client.APIRequest[*Token]

DeleteTokenRequest (no documentation).

func (*API) DeleteWorkspace

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

func (*API) DeleteWorkspaceConfigRequest

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

func (*API) DeleteWorkspaceJobRequest

func (a *API) DeleteWorkspaceJobRequest(workspaceID WorkspaceID) client.APIRequest[client.NoResult]

func (*API) EncryptRequest

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

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

func (*API) GetDefaultBranchRequest

func (a *API) GetDefaultBranchRequest() client.APIRequest[*Branch]

GetDefaultBranchRequest lists all branches and returns the default branch.

func (*API) GetFileWithCredentialsRequest added in v1.4.0

func (a *API) GetFileWithCredentialsRequest(id int) client.APIRequest[*FileDownloadCredentials]

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

func (*API) GetOldQueueJobRequest deprecated added in v1.3.0

func (a *API) GetOldQueueJobRequest(
	jobID JobID,
	opts ...GetOldQueueJobOption,
) client.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 (*API) GetWorkspace

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

func (*API) GetWorkspaceConfigRequest

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

func (*API) GetWorkspaceInstanceRequest

func (a *API) GetWorkspaceInstanceRequest(workspaceID WorkspaceID) client.APIRequest[*Workspace]

func (*API) Index

func (a *API) Index() *Index

func (*API) IndexComponentsRequest

func (a *API) IndexComponentsRequest() client.APIRequest[*IndexComponents]

IndexComponentsRequest returns index of Storage API with components definitions.

func (*API) IndexRequest

func (a *API) IndexRequest() client.APIRequest[*Index]

IndexRequest returns index of Storage API without components definitions.

func (*API) ListConfigRequest

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

func (*API) ListFilesRequest

func (a *API) ListFilesRequest() client.APIRequest[*[]*File]

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

func (*API) ListWorkspaceConfigRequest

func (a *API) ListWorkspaceConfigRequest(branchID BranchID) client.APIRequest[*[]*Config]

func (*API) ListWorkspaceInstancesRequest

func (a *API) ListWorkspaceInstancesRequest() client.APIRequest[*[]*Workspace]

func (*API) ListWorkspaces

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

func (*API) LoadDataFromFileRequest

func (a *API) LoadDataFromFileRequest(tableID TableID, dataFileID int, opts ...LoadDataOption) client.APIRequest[*StorageJob]

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

func (*API) NewCreateJobRequest added in v1.5.0

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

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

func (*API) PreviewTableRequest added in v1.1.0

func (a *API) PreviewTableRequest(tableID TableID, opts ...PreviewOption) client.APIRequest[*TablePreview]

func (*API) UpdateBranchRequest

func (a *API) UpdateBranchRequest(branch *Branch, changedFields []string) client.APIRequest[*Branch]

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

func (*API) UpdateRequest

func (a *API) UpdateRequest(object Object, changedFields []string) client.APIRequest[Object]

UpdateRequest creates request to update object according its type.

func (*API) WaitForOldQueueJob deprecated added in v1.3.0

func (a *API) WaitForOldQueueJob(ctx context.Context, id JobID) 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 (*API) WaitForQueueJob

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

WaitForQueueJob pulls job status until it is completed.

func (*API) WaitForStorageJob

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

WaitForStorageJob pulls job status until it is completed.

type APIOption

type APIOption func(c *apiConfig)

func WithClient

func WithClient(cl *client.Client) APIOption

func WithToken

func WithToken(token string) APIOption

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 {
	ID             BucketID      `json:"id"`
	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 ParseBucketIDExpectMagicPrefix added in v1.1.0

func ParseBucketIDExpectMagicPrefix(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 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 ColumnMetadata

type ColumnMetadata map[string]MetadataDetail

func (*ColumnMetadata) UnmarshalJSON

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

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

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 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 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.

type File

type File struct {
	ID              int          `json:"id" readonly:"true"`
	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 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 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"`
}

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 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.

type MetadataDetail

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

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 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 Option

type Option func(c *listTablesConfig)

func WithBuckets

func WithBuckets() Option

func WithColumnMetadata

func WithColumnMetadata() Option

func WithColumns

func WithColumns() Option

func WithMetadata

func WithMetadata() Option

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 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 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 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 {
	ID             TableID          `json:"id"`
	URI            string           `json:"uri"`
	Name           string           `json:"name"`
	DisplayName    string           `json:"displayName"`
	PrimaryKey     []string         `json:"primaryKey"`
	Created        iso8601.Time     `json:"created"`
	LastImportDate iso8601.Time     `json:"lastImportDate"`
	LastChangeDate *iso8601.Time    `json:"lastChangeDate"`
	RowsCount      uint64           `json:"rowsCount"`
	DataSizeBytes  uint64           `json:"dataSizeBytes"`
	Columns        []string         `json:"columns"`
	Metadata       []MetadataDetail `json:"metadata"`
	ColumnMetadata ColumnMetadata   `json:"columnMetadata"`
	Bucket         *Bucket          `json:"bucket"`
}

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

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 TablePreview added in v1.1.0

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

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 *API) *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 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"`
}

TokenOwner - owner of Token.

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