storageapi

package
v0.18.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package storageapi contains request definitions for the Storage 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. It is necessary to set API host and "X-StorageApi-Token" header in the HTTP client, see the ClientWithHost and the ClientWithHostAndToken functions.

Index

Constants

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.

Variables

This section is empty.

Functions

func AppendMetadataRequest

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

AppendMetadataRequest creates request to append object metadata according its type.

func CleanProjectRequest

func 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 ClientForAnEmptyProject added in v0.13.0

func ClientForAnEmptyProject(t *testing.T, opts ...testproject.Option) client.Sender

func ClientForRandomProject added in v0.13.0

func ClientForRandomProject(t *testing.T, opts ...testproject.Option) (*testproject.Project, client.Client)

func ClientWithHost

func ClientWithHost(c client.Client, apiHost string) client.Client

ClientWithHost returns HTTP client with api host set.

func ClientWithHostAndToken

func ClientWithHostAndToken(c client.Client, apiHost, apiToken string) client.Client

ClientWithHostAndToken returns HTTP client with api host and token set.

func ClientWithToken

func ClientWithToken(c client.Client, apiToken string) client.Client

ClientWithToken returns HTTP client with api token set.

func CreateFileResourceRequest added in v0.13.0

func CreateFileResourceRequest(file *File) client.APIRequest[*File]

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

func CreateRequest

func CreateRequest(object Object) client.APIRequest[Object]

CreateRequest creates request to create object according its type.

func CreateTableDeprecatedSyncRequest added in v0.18.5

func CreateTableDeprecatedSyncRequest(tableID TableID, columns []string, opts ...CreateTableOption) (client.APIRequest[*Table], error)

CreateTableDeprecatedSyncRequest https://keboola.docs.apiary.io/#reference/tables/create-or-list-tables/create-new-table-from-csv-file

func DeleteConfigsInBranchRequest

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

DeleteConfigsInBranchRequest lists all configs in branch and deletes them all.

func DeleteMetadataRequest added in v0.3.0

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

DeleteMetadataRequest creates request to delete object metadata according its type.

func DeleteRequest

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

DeleteRequest creates request to delete object according its type.

func DeleteTokenRequest added in v0.18.0

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

DeleteTokenRequest (no documentation).

func GetDefaultBranchRequest

func GetDefaultBranchRequest() client.APIRequest[*Branch]

GetDefaultBranchRequest lists all branches and returns the default branch.

func IndexComponentsRequest

func IndexComponentsRequest() client.APIRequest[*IndexComponents]

IndexComponentsRequest returns index of Storage API with components definitions.

func IndexRequest

func IndexRequest() client.APIRequest[*Index]

IndexRequest returns index of Storage API without components definitions.

func ListConfigRequest added in v0.5.0

func ListConfigRequest(branchId BranchID, componentId ComponentID) client.APIRequest[*[]*Config]

func ListFilesRequest added in v0.18.4

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

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

func ListTablesRequest added in v0.5.0

func ListTablesRequest(opts ...Option) client.APIRequest[*[]*Table]

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

func LoadDataFromFileRequest added in v0.14.0

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

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

func NewSliceUrl added in v0.14.0

func NewSliceUrl(file *File, slice string) (string, error)

func NewUploadSliceWriter added in v0.14.0

func NewUploadSliceWriter(ctx context.Context, file *File, slice string, opts ...UploadOptions) (*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 added in v0.14.0

func NewUploadWriter(ctx context.Context, file *File, opts ...UploadOptions) (*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 UpdateRequest

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

UpdateRequest creates request to update object according its type.

func Upload added in v0.14.0

func Upload(ctx context.Context, file *File, 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 added in v0.14.0

func UploadSlice(ctx context.Context, file *File, 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 added in v0.14.0

func UploadSlicedFileManifest(ctx context.Context, file *File, 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 WaitForJob added in v0.14.0

func WaitForJob(ctx context.Context, sender client.Sender, job *Job) error

WaitForJob pulls job status until it is completed.

func WithColumnsHeaders added in v0.14.0

func WithColumnsHeaders(c []string) columnsHeadersOption

func WithDelimiter added in v0.14.0

func WithDelimiter(d string) delimiterOption

func WithEnclosure added in v0.14.0

func WithEnclosure(e string) enclosureOption

func WithEscapedBy added in v0.14.0

func WithEscapedBy(e string) escapedByOption

func WithIncrementalLoad added in v0.14.0

func WithIncrementalLoad(i bool) incrementalLoadOption

func WithPrimaryKey added in v0.14.0

func WithPrimaryKey(pk []string) primaryKeyOption

func WithoutHeader added in v0.14.0

func WithoutHeader(h bool) withoutHeaderOption

Types

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 added in v0.5.0

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 added in v0.5.0

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

func MustParseBucketID added in v0.18.2

func MustParseBucketID(v string) BucketID

func ParseBucketID added in v0.18.2

func ParseBucketID(v string) (BucketID, error)

func (BucketID) MarshalJSON added in v0.18.2

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

func (BucketID) String added in v0.5.0

func (v BucketID) String() string

func (*BucketID) UnmarshalJSON added in v0.18.2

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

type BucketPermission added in v0.16.0

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

type BucketPermissions added in v0.18.0

type BucketPermissions map[BucketID]BucketPermission

func (BucketPermissions) MarshalJSON added in v0.18.3

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

func (*BucketPermissions) UnmarshalJSON added in v0.18.0

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 added in v0.14.0

type ColumnMetadata map[string]MetadataDetail

func (*ColumnMetadata) UnmarshalJSON added in v0.14.0

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 added in v0.18.1

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 CreateTableOption added in v0.14.0

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

CreateTableOption applies to the request for creating table from file.

type CreateTokenOption added in v0.18.0

type CreateTokenOption func(*createTokenOptions)

func WithBucketPermission added in v0.16.0

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 added in v0.18.5

func WithBucketPermissions(v BucketPermissions) CreateTokenOption

WithBucketPermissions set token buckets permissions.

func WithCanManageBuckets added in v0.16.0

func WithCanManageBuckets(canManageBuckets bool) CreateTokenOption

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

func WithCanPurgeTrash added in v0.16.0

func WithCanPurgeTrash(canPurgeTrash bool) CreateTokenOption

WithCanPurgeTrash allows this token to permanently delete configurations.

func WithCanReadAllFileUploads added in v0.16.0

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 added in v0.16.0

func WithComponentAccess(component string) CreateTokenOption

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

func WithDescription added in v0.16.0

func WithDescription(description string) CreateTokenOption

WithDescription sets the token's description.

func WithExpiresIn added in v0.16.0

func WithExpiresIn(expiresIn time.Duration) CreateTokenOption

WithExpiresIn sets the time until the token expires.

type CreatorToken added in v0.16.0

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

type DeleteOption added in v0.9.0

type DeleteOption func(c *deleteConfig)

DeleteOption for requests to delete bucket or table.

func WithForce added in v0.7.0

func WithForce() DeleteOption

type Error

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

Error represents the structure of Storage API error.

func (Error) Error

func (e Error) Error() string

func (Error) ErrorExceptionID

func (e Error) ErrorExceptionID() string

ErrorExceptionID returns exception ID to find details in logs.

func (Error) ErrorName

func (e Error) ErrorName() string

ErrorName returns a human-readable name of the error.

func (Error) ErrorUserMessage

func (e Error) ErrorUserMessage() string

ErrorUserMessage returns error message for end user.

func (*Error) SetRequest

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

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

func (*Error) SetResponse

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

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

func (Error) StatusCode

func (e Error) 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 added in v0.13.0

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"`
	ABSUploadParams *abs.UploadParams `json:"absUploadParams,omitempty" readonly:"true"`
	GCSUploadParams *gcs.UploadParams `json:"gcsUploadParams,omitempty" readonly:"true"`
	S3UploadParams  *s3.UploadParams  `json:"uploadParams,omitempty" readonly:"true"`

	ContentType     string `json:"contentType,omitempty"`
	FederationToken bool   `json:"federationToken,omitempty"`
	IsPermanent     bool   `json:"isPermanent,omitempty"`
	Notify          bool   `json:"notify,omitempty"`
}

type Index

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

Index of Storage API.

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.

type JSONString

type JSONString map[string]any

JSONString is Json encoded as string, see CreatEventRequest.

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 Job

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

Job is a storage job.

type JobError added in v0.14.0

type JobError struct {
	Code        string `json:"code"`
	Message     string `json:"message"`
	ExceptionId string `json:"exceptionId"`
}

type JobID

type JobID int

JobID is an ID of a storage job.

func (JobID) String

func (id JobID) String() string

type JobKey

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

JobKey is a unique identifier of Job.

type JobResult added in v0.14.0

type JobResult map[string]any

func (*JobResult) UnmarshalJSON added in v0.14.0

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

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

type ListBucketsOption added in v0.7.0

type ListBucketsOption func(c *listBucketsConfig)

type LoadDataOption added in v0.14.0

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 Object

type Object interface {
	ObjectId() any
}

type Option added in v0.5.0

type Option func(c *listTablesConfig)

func WithBuckets added in v0.5.0

func WithBuckets() Option

func WithColumnMetadata added in v0.5.0

func WithColumnMetadata() Option

func WithColumns added in v0.5.0

func WithColumns() Option

func WithMetadata added in v0.5.0

func WithMetadata() Option

type RowID

type RowID string

RowID is id of configuration row.

func (RowID) String

func (v RowID) String() string

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 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) URLByID

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

URLByID return service URL by service ID.

type Slice added in v0.14.0

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

type SlicedFileManifest added in v0.14.0

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

func NewSlicedFileManifest added in v0.14.0

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

type Table added in v0.5.0

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

func CreateTable added in v0.14.0

func CreateTable(ctx context.Context, sender client.Sender, tableID TableID, columns []string, opts ...CreateTableOption) (*Table, error)

CreateTable creates an empty table with given columns.

type TableID added in v0.5.0

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

func MustParseTableID added in v0.18.2

func MustParseTableID(v string) TableID

func ParseTableID added in v0.18.2

func ParseTableID(v string) (TableID, error)

func (TableID) MarshalJSON added in v0.18.2

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

func (TableID) String added in v0.5.0

func (v TableID) String() string

func (*TableID) UnmarshalJSON added in v0.18.2

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

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, sender client.Sender) *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 added in v0.16.0

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 TokenOwner

type TokenOwner struct {
	ID       int      `json:"id"`
	Name     string   `json:"name"`
	Features Features `json:"features"`
}

TokenOwner - owner of Token.

type UploadOptions added in v0.14.0

type UploadOptions func(c *uploadConfig)

func WithUploadTransport added in v0.14.0

func WithUploadTransport(transport http.RoundTripper) UploadOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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