Documentation ¶
Overview ¶
Package rockset provides a go client to interact with the Rockset database.
The client uses the Rockset REST API https://docs.rockset.com/rest-api/, and is an OpenAPI generated code by https://openapi-generator.tech/.
It provides convenience functions for all API calls to make the generated client easier to use, by wrapping the API calls in methods that require passing a context.Context and having all required arguments in the method signature, so that as many errors as possible are caught at compile time instead of at runtime. It uses functional options for any optional arguments. The convenience methods return the payload data from the models package, to reduce the indirection.
All methods also automatically retries any retryable error returned by the Rockset API, using exponential back-off. The retryable errors are defined in rockset.RetryableErrors.
If a zerolog logger is set in the context, the methods will log to it. E.g.
console := zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339} log := zerolog.New(console).Level(zerolog.TraceLevel).With().Timestamp().Logger() ctx := log.WithContext(context.Background()) rc, err := rockset.NewClient() if err != nil { log.Fatalf("failed to create RockClient: %v," err) } wsName := "commons" ws, err := rc.GetWorkspace(ctx, wsName) if err != nil { log.Fatalf("failed to get workspace %s: %v", wsName, err) }
Example log output
2021-05-28T13:11:46-07:00 TRC api call curation d=467.371958ms 2021-05-28T13:11:46-07:00 DBG total duration d=467.538875ms 2021-05-28T13:11:46-07:00 DBG get workspace successful name=commons
Example (QueryRaw) ¶
Raw usage of the openapi client
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } q := rc.QueriesApi.Query(ctx) rq := openapi.NewQueryRequestWithDefaults() rq.Sql = openapi.QueryRequestSql{Query: "SELECT * FROM commons._events where label = :label"} rq.Sql.DefaultRowLimit = openapi.PtrInt32(10) rq.Sql.Parameters = []openapi.QueryParameter{ { Name: "label", Type: "string", Value: "QUERY_SUCCESS", }, } r, _, err := q.Body(*rq).Execute() if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
Example (S3) ¶
Example code to first create an S3 integration, then create a collection from the integration, and finally clean up.
ctx := context.TODO() rc, randomName, err := vcrClient("example_s3") if err != nil { log.Fatal(err) } integration := randomName("example_s3") collectionName := randomName("example_s3") workspace := "example" // create integration r, err := rc.CreateS3Integration(ctx, integration, option.AWSRole("arn:aws:iam::469279130686:role/rockset-s3-integration"), option.WithS3IntegrationDescription("created by go example code")) if err != nil { log.Fatalf("failed to create integration: %v", err) } fmt.Printf("integration created: %s\n", r.GetName()) // create an S3 collection c, err := rc.CreateCollection(ctx, workspace, collectionName, option.WithCollectionDescription("created by go example code"), option.WithS3Source(integration, "rockset-go-tests", option.WithCSVFormat( []string{"city", "country", "population", "visited"}, []option.ColumnType{ option.ColumnTypeString, option.ColumnTypeString, option.ColumnTypeInteger, option.ColumnTypeBool, }, option.WithEncoding("UTF-8"), option.WithEscapeChar("\\"), option.WithQuoteChar(`"`), option.WithSeparator(","), ), option.WithS3Prefix("cities.csv"), ), option.WithIngestTransformation("SELECT * FROM _input"), ) if err != nil { log.Fatalf("failed to create collection: %v", err) } fmt.Printf("collection created: %s\n", c.GetName()) // wait until collection is ready err = rc.Wait.UntilCollectionReady(ctx, workspace, collectionName) if err != nil { log.Fatalf("failed to wait for collection to be ready: %v", err) } fmt.Printf("collection ready: %s\n", c.GetName()) // wait until there are at least 3 new documents in the collection err = rc.Wait.UntilCollectionHasDocuments(ctx, workspace, collectionName, 3) if err != nil { log.Fatalf("failed to wait for new documents: %v", err) } // get number of documents collection, err := rc.GetCollection(ctx, workspace, collectionName) if err != nil { log.Fatalf("failed to get collection: %v", err) } fmt.Printf("collection name: %s\n", collection.GetName()) // delete the collection err = rc.DeleteCollection(ctx, workspace, collectionName) if err != nil { log.Fatalf("failed to delete collection: %v", err) } fmt.Printf("collection deleted: %s\n", c.GetName()) // wait until the collection is gone err = rc.Wait.UntilCollectionGone(ctx, workspace, collectionName) if err != nil { log.Fatalf("failed to wait for collection to be gone: %v", err) } fmt.Printf("collection gone: %s\n", c.GetName()) // delete integration err = rc.DeleteIntegration(ctx, integration) if err != nil { log.Fatalf("failed to delete integration: %v", err) } fmt.Printf("integration deleted: %s\n", r.GetName())
Output: integration created: go_example_s3 collection created: go_example_s3 collection ready: go_example_s3 collection name: go_example_s3 collection deleted: go_example_s3 collection gone: go_example_s3 integration deleted: go_example_s3
Index ¶
- Constants
- Variables
- func ValidEntityName(name string) error
- type PatchDocument
- type PatchOperation
- type RockClient
- func (rc *RockClient) AddDocuments(ctx context.Context, workspace, collection string, docs []interface{}) ([]openapi.DocumentStatus, error)
- func (rc *RockClient) AddDocumentsRaw(ctx context.Context, workspace, collection string, docs json.RawMessage) ([]openapi.DocumentStatus, error)
- func (rc *RockClient) AddDocumentsWithOffset(ctx context.Context, workspace, collection string, docs []interface{}) (openapi.AddDocumentsResponse, error)
- func (rc *RockClient) CancelQuery(ctx context.Context, queryID string) (openapi.QueryInfo, error)
- func (rc *RockClient) CreateAPIKey(ctx context.Context, keyName string, options ...option.APIKeyRoleOption) (openapi.ApiKey, error)
- func (rc *RockClient) CreateAlias(ctx context.Context, workspace, alias string, collections []string, ...) (openapi.Alias, error)
- func (rc *RockClient) CreateAzureBlobStorageIntegration(ctx context.Context, name string, connection string) (openapi.Integration, error)
- func (rc *RockClient) CreateCollection(ctx context.Context, workspace, name string, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateDynamoDBCollection(ctx context.Context, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateDynamoDBIntegration(ctx context.Context, name string, creds option.AWSCredentialsFn, ...) (openapi.Integration, error)
- func (rc *RockClient) CreateFileUploadCollection(ctx context.Context, workspace, name, description, fileName string, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateGCSCollection(ctx context.Context, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateGCSIntegration(ctx context.Context, name, serviceAccountKeyFileJSON string, ...) (openapi.Integration, error)
- func (rc *RockClient) CreateKafkaCollection(ctx context.Context, workspace, name string, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateKafkaIntegration(ctx context.Context, name string, options ...option.KafkaIntegrationOption) (openapi.Integration, error)
- func (rc *RockClient) CreateKinesisCollection(ctx context.Context, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateKinesisIntegration(ctx context.Context, name string, creds option.AWSCredentialsFn, ...) (openapi.Integration, error)
- func (rc *RockClient) CreateMongoDBCollection(ctx context.Context, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateMongoDBIntegration(ctx context.Context, name, connectionURI string, ...) (openapi.Integration, error)
- func (rc *RockClient) CreateQueryLambda(ctx context.Context, workspace, name, sql string, ...) (openapi.QueryLambdaVersion, error)
- func (rc *RockClient) CreateQueryLambdaTag(ctx context.Context, workspace, name, version, tag string) (openapi.QueryLambdaTag, error)
- func (rc *RockClient) CreateRole(ctx context.Context, roleName string, options ...option.RoleOption) (openapi.Role, error)
- func (rc *RockClient) CreateS3Collection(ctx context.Context, ...) (openapi.Collection, error)
- func (rc *RockClient) CreateS3Integration(ctx context.Context, name string, creds option.AWSCredentialsFn, ...) (openapi.Integration, error)
- func (rc *RockClient) CreateScheduledLambda(ctx context.Context, workspace, apikey string, cronString string, ...) (openapi.ScheduledLambda, error)
- func (rc *RockClient) CreateUser(ctx context.Context, email string, roles []string) (openapi.User, error)
- func (rc *RockClient) CreateView(ctx context.Context, workspace, view, query string, ...) (openapi.View, error)
- func (rc *RockClient) CreateVirtualInstance(ctx context.Context, name string, options ...option.VirtualInstanceOption) (openapi.VirtualInstance, error)
- func (rc *RockClient) CreateWorkspace(ctx context.Context, workspace string, options ...option.WorkspaceOption) (openapi.Workspace, error)
- func (rc *RockClient) DeleteAPIKey(ctx context.Context, keyName string, options ...option.APIKeyOption) error
- func (rc *RockClient) DeleteAlias(ctx context.Context, workspace, alias string) error
- func (rc *RockClient) DeleteCollection(ctx context.Context, workspace, name string) error
- func (rc *RockClient) DeleteDocuments(ctx context.Context, workspace, collection string, docIDs []string) ([]openapi.DocumentStatus, error)
- func (rc *RockClient) DeleteDocumentsWithOffset(ctx context.Context, workspace, collection string, docIDs []string) (openapi.DeleteDocumentsResponse, error)
- func (rc *RockClient) DeleteIntegration(ctx context.Context, name string) error
- func (rc *RockClient) DeleteQueryLambda(ctx context.Context, workspace, name string) error
- func (rc *RockClient) DeleteQueryLambdaTag(ctx context.Context, workspace, name, tag string) error
- func (rc *RockClient) DeleteQueryLambdaVersion(ctx context.Context, workspace, name, version string) error
- func (rc *RockClient) DeleteRole(ctx context.Context, roleName string) error
- func (rc *RockClient) DeleteScheduledLambda(ctx context.Context, workspace, scheduledLambdaRRN string) error
- func (rc *RockClient) DeleteUser(ctx context.Context, email string) error
- func (rc *RockClient) DeleteView(ctx context.Context, workspace, view string) error
- func (rc *RockClient) DeleteVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
- func (rc *RockClient) DeleteWorkspace(ctx context.Context, name string) error
- func (rc *RockClient) ExecuteQueryLambda(ctx context.Context, workspace, name string, ...) (openapi.QueryResponse, error)
- func (rc *RockClient) ExecuteQueryOnVirtualInstance(ctx context.Context, vID string, sql string, options ...option.QueryOption) (openapi.QueryResponse, error)
- func (rc *RockClient) GetAPIKey(ctx context.Context, name string, options ...option.APIKeyOption) (openapi.ApiKey, error)
- func (rc *RockClient) GetAlias(ctx context.Context, workspace, alias string) (openapi.Alias, error)
- func (rc *RockClient) GetCollection(ctx context.Context, workspace, name string) (openapi.Collection, error)
- func (rc *RockClient) GetCollectionCommit(ctx context.Context, workspace, name string, offsets []string) (openapi.GetCollectionCommitData, error)
- func (rc *RockClient) GetCollectionMount(ctx context.Context, vID, collectionPath string) (openapi.CollectionMount, error)
- func (rc *RockClient) GetCurrentUser(ctx context.Context) (openapi.User, error)
- func (rc *RockClient) GetIntegration(ctx context.Context, name string) (openapi.Integration, error)
- func (rc *RockClient) GetOrganization(ctx context.Context) (openapi.Organization, error)
- func (rc *RockClient) GetQueryInfo(ctx context.Context, queryID string) (openapi.QueryInfo, error)
- func (rc *RockClient) GetQueryLambdaVersion(ctx context.Context, workspace, name, version string) (openapi.QueryLambdaVersion, error)
- func (rc *RockClient) GetQueryLambdaVersionByTag(ctx context.Context, workspace, name, tag string) (openapi.QueryLambdaTag, error)
- func (rc *RockClient) GetQueryResults(ctx context.Context, queryID string, options ...option.QueryResultOption) (openapi.QueryPaginationResponse, error)
- func (rc *RockClient) GetRole(ctx context.Context, roleName string) (openapi.Role, error)
- func (rc *RockClient) GetScheduledLambda(ctx context.Context, workspace, scheduledLambdaRRN string) (openapi.ScheduledLambda, error)
- func (rc *RockClient) GetUser(ctx context.Context, email string) (openapi.User, error)
- func (rc *RockClient) GetView(ctx context.Context, workspace, name string) (openapi.View, error)
- func (rc *RockClient) GetVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
- func (rc *RockClient) GetWorkspace(ctx context.Context, workspace string) (openapi.Workspace, error)
- func (rc *RockClient) ListAPIKeys(ctx context.Context, options ...option.APIKeyOption) ([]openapi.ApiKey, error)
- func (rc *RockClient) ListActiveQueries(ctx context.Context) ([]openapi.QueryInfo, error)
- func (rc *RockClient) ListAliases(ctx context.Context, options ...option.ListAliasesOption) ([]openapi.Alias, error)
- func (rc *RockClient) ListCollectionMounts(ctx context.Context, vID string) ([]openapi.CollectionMount, error)
- func (rc *RockClient) ListCollections(ctx context.Context, options ...option.ListCollectionOption) ([]openapi.Collection, error)
- func (rc *RockClient) ListIntegrations(ctx context.Context) ([]openapi.Integration, error)
- func (rc *RockClient) ListQueryLambdaTags(ctx context.Context, workspace, queryLambda string) ([]openapi.QueryLambdaTag, error)
- func (rc *RockClient) ListQueryLambdaVersions(ctx context.Context, workspace, name string) ([]openapi.QueryLambdaVersion, error)
- func (rc *RockClient) ListQueryLambdas(ctx context.Context, options ...option.ListQueryLambdaOption) ([]openapi.QueryLambda, error)
- func (rc *RockClient) ListRoles(ctx context.Context) ([]openapi.Role, error)
- func (rc *RockClient) ListUsers(ctx context.Context) ([]openapi.User, error)
- func (rc *RockClient) ListViews(ctx context.Context, options ...option.ListViewOption) ([]openapi.View, error)
- func (rc *RockClient) ListVirtualInstanceQueries(ctx context.Context, vID string) ([]openapi.QueryInfo, error)
- func (rc *RockClient) ListVirtualInstances(ctx context.Context) ([]openapi.VirtualInstance, error)
- func (rc *RockClient) ListWorkspaces(ctx context.Context) ([]openapi.Workspace, error)
- func (rc *RockClient) MountCollections(ctx context.Context, vID string, collectionPaths []string) ([]openapi.CollectionMount, error)
- func (rc *RockClient) PatchDocuments(ctx context.Context, workspace, collection string, patches []PatchDocument) ([]openapi.DocumentStatus, error)
- func (rc *RockClient) Ping(ctx context.Context) error
- func (rc *RockClient) Query(ctx context.Context, sql string, options ...option.QueryOption) (openapi.QueryResponse, error)
- func (rc *RockClient) ResumeVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
- func (rc *RockClient) SuspendVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
- func (rc *RockClient) UnmountCollection(ctx context.Context, vID string, collectionPath string) (openapi.CollectionMount, error)
- func (rc *RockClient) UpdateAPIKey(ctx context.Context, keyName string, options ...option.APIKeyOption) (openapi.ApiKey, error)
- func (rc *RockClient) UpdateAlias(ctx context.Context, workspace, alias string, collections []string, ...) error
- func (rc *RockClient) UpdateCollection(ctx context.Context, workspace, name string, ...) (openapi.Collection, error)
- func (rc *RockClient) UpdateQueryLambda(ctx context.Context, workspace, name, sql string, ...) (openapi.QueryLambdaVersion, error)
- func (rc *RockClient) UpdateRole(ctx context.Context, roleName string, options ...option.RoleOption) (openapi.Role, error)
- func (rc *RockClient) UpdateScheduledLambda(ctx context.Context, workspace string, scheduledLambdaRRN string, ...) (openapi.ScheduledLambda, error)
- func (rc *RockClient) UpdateUser(ctx context.Context, email string, roles []string, ...) (openapi.User, error)
- func (rc *RockClient) UpdateView(ctx context.Context, workspace, view, query string, ...) (openapi.View, error)
- func (rc *RockClient) UpdateVirtualInstance(ctx context.Context, vID string, options ...option.VirtualInstanceOption) (openapi.VirtualInstance, error)
- func (rc *RockClient) ValidateQuery(ctx context.Context, sql string, options ...option.QueryOption) (openapi.ValidateQueryResponse, error)
- type RockConfig
- type RockOption
- func WithAPIClient(c *openapi.APIClient) RockOption
- func WithAPIKey(apiKey string) RockOption
- func WithAPIServer(server string) RockOption
- func WithBearerToken(token, org string) RockOption
- func WithCustomHeader(key, value string) RockOption
- func WithHTTPClient(c *http.Client) RockOption
- func WithHTTPDebug() RockOption
- func WithRetry(r retry.Retrier) RockOption
- func WithUserAgent(name string) RockOption
Examples ¶
Constants ¶
const ( // APIKeyEnvironmentVariableName is the environment variable name for the API key APIKeyEnvironmentVariableName = "ROCKSET_APIKEY" //nolint // APIServerEnvironmentVariableName is the environment variable name for the API server APIServerEnvironmentVariableName = "ROCKSET_APISERVER" // DefaultUserAgent is the user agent string the Rockset go client will use for REST API calls. DefaultUserAgent = "rockset-go-client" // HeaderVersionName is the name of the HTTP header the go client sets which contains the client version used. HeaderVersionName = "x-rockset-version" )
const ( ReadOnlyRole = "read-only" MemberRole = "member" AdminRole = "admin" )
const LatestTag = "latest"
LatestTag is the query lambda tag for the latest version.
const Version = "0.25.0"
Version is the Rockset client version
Variables ¶
Functions ¶
func ValidEntityName ¶ added in v0.21.1
ValidEntityName is used to validate if a name is valid for a workspace, collection, etc
Types ¶
type PatchDocument ¶ added in v0.13.0
type PatchDocument struct { ID string `json:"_id"` Patches []PatchOperation `json:"patch"` }
type PatchOperation ¶ added in v0.13.0
type RockClient ¶
type RockClient struct { *openapi.APIClient RockConfig }
RockClient is the client struct for making APi calls to Rockset.
Example (Query) ¶
Query convenience method
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } r, err := rc.Query(ctx, "SELECT * FROM commons._events where label = :label", option.WithDefaultRowLimit(10), option.WithParameter("label", "string", "QUERY_SUCCESS")) if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
Example (QueryLambda) ¶
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } r, err := rc.ExecuteQueryLambda(ctx, "commons", "eventType") if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
Example (QueryLambdaByTag) ¶
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } r, err := rc.ExecuteQueryLambda(ctx, "commons", "eventType", option.WithTag("test")) if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
Example (QueryLambdaByVersion) ¶
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } r, err := rc.ExecuteQueryLambda(ctx, "commons", "eventType", option.WithVersion("e4e67e8835063d03")) if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
Example (ValidateQuery) ¶
ctx := context.TODO() rc, err := rockset.NewClient() if err != nil { log.Fatal(err) } r, err := rc.Query(ctx, "SELECT * FROM commons._events where label = :label", option.WithParameter("label", "string", "QUERY_SUCCESS")) if err != nil { log.Fatal(err) } for _, c := range r.Collections { fmt.Printf("collection: %s\n", c) }
Output: collection: commons._events
func NewClient ¶ added in v0.8.0
func NewClient(options ...RockOption) (*RockClient, error)
NewClient creates a new Rockset client.
Accessing the online database requires an API key and an API server to connect to, which can be provided by through the ROCKSET_APIKEY and ROCKSET_APISERVER environment variables,
c, err := rockset.NewClient()
or they can be explicitly set using the WithAPIKey() and WithAPIServer() options.
c, err := rockset.NewClient(rockset.WithAPIKey("..."), rockset.WithAPIServer("..."))
func (*RockClient) AddDocuments ¶ added in v0.12.0
func (rc *RockClient) AddDocuments(ctx context.Context, workspace, collection string, docs []interface{}) ([]openapi.DocumentStatus, error)
AddDocuments adds new documents to a collection
REST API documentation https://docs.rockset.com/rest-api/#adddocuments
func (*RockClient) AddDocumentsRaw ¶ added in v0.26.0
func (rc *RockClient) AddDocumentsRaw(ctx context.Context, workspace, collection string, docs json.RawMessage) ([]openapi.DocumentStatus, error)
AddDocumentsRaw is a convenience method that adds new documents to a collection using a raw JSON payload, which has to be an array of objects.
This method is useful when the documents are already in JSON format and do not need to be converted to a []map[string]interface{} slice, which is required by AddDocuments() and AddDocumentsWithOffset().
func (*RockClient) AddDocumentsWithOffset ¶ added in v0.23.0
func (rc *RockClient) AddDocumentsWithOffset(ctx context.Context, workspace, collection string, docs []interface{}) (openapi.AddDocumentsResponse, error)
AddDocumentsWithOffset adds new documents to a collection, and returns the response with the offset(s), which can be used to wait until the collection includes the documents at or after the specified offset(s).
response, err := rs.AddDocumentsWithOffset(ctx, "commons", "users", docs) if err != nil { return err } w := wait.New(rs) err = w.UntilQueryable(ctx, "commons", "users", []string{response.GetLastOffset()})
The added documents are now queryable in the collection.
func (*RockClient) CancelQuery ¶ added in v0.15.0
CancelQuery cancels a queued or running query.
func (*RockClient) CreateAPIKey ¶ added in v0.12.0
func (rc *RockClient) CreateAPIKey(ctx context.Context, keyName string, options ...option.APIKeyRoleOption) (openapi.ApiKey, error)
CreateAPIKey creates a new API key for the current user with the specified, with an optional role.
REST API documentation https://docs.rockset.com/rest-api/#createapikey
func (*RockClient) CreateAlias ¶ added in v0.12.0
func (rc *RockClient) CreateAlias(ctx context.Context, workspace, alias string, collections []string, options ...option.AliasOption) (openapi.Alias, error)
CreateAlias creates a new alias for a list of fully qualified collections, with an optional alias description using option.WithAliasDescription()
REST API documentation https://docs.rockset.com/rest-api/#createalias
func (*RockClient) CreateAzureBlobStorageIntegration ¶ added in v0.15.0
func (rc *RockClient) CreateAzureBlobStorageIntegration(ctx context.Context, name string, connection string) (openapi.Integration, error)
CreateAzureBlobStorageIntegration creates an integration for Azure's Blob Storage. requires a name for the integration and a connection string for the blob storage.
func (*RockClient) CreateCollection ¶ added in v0.12.0
func (rc *RockClient) CreateCollection(ctx context.Context, workspace, name string, options ...option.CollectionOption) (openapi.Collection, error)
CreateCollection is used to create a collection from one or more sources:
- DynamoDB (see CreateDynamoDBIntegration())
- GCS (see CreateGCSIntegration())
- Kafka (see CreateKafkaIntegration())
- Kinesis (see CreateKinesisIntegration())
- MongoDB (see CreateMongoDBIntegration())
- S3 (see CreateS3Integration())
It uses exponential backoff in case the API call is rate-limted.
To create a collection from multiple sources, use:
c, err := rc.CreateCollection(ctx, "commons", "example", option.WithCollectionDescription("created by go example code"), option.WithS3Source("s3-integration-name", "rockset-go-tests", option.WithCSVFormat( []string{"city", "country", "population", "visited"}, []option.ColumnType{ option.ColumnTypeString, option.ColumnTypeString, option.ColumnTypeInteger, option.ColumnTypeBool, }, option.WithEncoding("UTF-8"), option.WithEscapeChar("\\"), option.WithQuoteChar(`"`), option.WithSeparator(","), ), option.WithS3Prefix("cities.csv"), ), option.WithKafkaSource("kafka-integration-name", "topic", option.KafkaStartingOffsetEarliest, option.WithJSONFormat(), option.WithKafkaSourceV3(), ), option.WithCollectionRetention(time.Hour), option.WithFieldMappingQuery("SELECT * FROM _input"), )
func (*RockClient) CreateDynamoDBCollection ¶ added in v0.11.0
func (rc *RockClient) CreateDynamoDBCollection(ctx context.Context, workspace, name, description, integration, region, tableName string, maxRCU int64, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
func (*RockClient) CreateDynamoDBIntegration ¶ added in v0.11.0
func (rc *RockClient) CreateDynamoDBIntegration(ctx context.Context, name string, creds option.AWSCredentialsFn, s3BucketName string, options ...option.DynamoDBIntegrationOption) (openapi.Integration, error)
CreateDynamoDBIntegration creates a new AWS DynamoDB integration. It requires AWS credentials using either option.AWSKeys() or option.AWSRole(), and an S3 bucket which is used to export the DynamoDB tables.
func (*RockClient) CreateFileUploadCollection ¶ added in v0.11.0
func (rc *RockClient) CreateFileUploadCollection(ctx context.Context, workspace, name, description, fileName string, fileSize int64, fileUploadTime time.Time, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
func (*RockClient) CreateGCSCollection ¶ added in v0.11.0
func (rc *RockClient) CreateGCSCollection(ctx context.Context, workspace, name, description, integration, bucket, prefix string, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
func (*RockClient) CreateGCSIntegration ¶ added in v0.11.0
func (rc *RockClient) CreateGCSIntegration(ctx context.Context, name, serviceAccountKeyFileJSON string, options ...option.GCSIntegrationOption) (openapi.Integration, error)
func (*RockClient) CreateKafkaCollection ¶ added in v0.11.0
func (rc *RockClient) CreateKafkaCollection(ctx context.Context, workspace, name string, options ...option.CollectionOption) (openapi.Collection, error)
CreateKafkaCollection creates a single collection from a Kafka integration. Requires using option.WithKafkaSource() to configure the Kafka source options.
rc, err := rockset.NewClient() if err != nil { ... } c, err := rc.CreateKafkaCollection(ctx, "workspace", "collection", option.WithCollectionRetention(time.Hour), option.WithKafkaSource("integration-name", "topic", option.KafkaStartingOffsetEarliest, option.WithJSONFormat(), )) if err != nil { ... } if err = rc.WaitUntilCollectionReady(ctx, "workspace", "collection"); err != nil { ... }
func (*RockClient) CreateKafkaIntegration ¶ added in v0.12.0
func (rc *RockClient) CreateKafkaIntegration(ctx context.Context, name string, options ...option.KafkaIntegrationOption) (openapi.Integration, error)
CreateKafkaIntegration create a new integration for a Kafka source. If no format is specified, it defaults to JSON.
func (*RockClient) CreateKinesisCollection ¶ added in v0.11.0
func (rc *RockClient) CreateKinesisCollection(ctx context.Context, workspace, name, description, integration, region, stream string, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
func (*RockClient) CreateKinesisIntegration ¶ added in v0.11.0
func (rc *RockClient) CreateKinesisIntegration(ctx context.Context, name string, creds option.AWSCredentialsFn, options ...option.KinesisIntegrationOption) (openapi.Integration, error)
func (*RockClient) CreateMongoDBCollection ¶ added in v0.11.0
func (rc *RockClient) CreateMongoDBCollection(ctx context.Context, workspace, name, description, integration, database, collection string, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
func (*RockClient) CreateMongoDBIntegration ¶ added in v0.12.0
func (rc *RockClient) CreateMongoDBIntegration(ctx context.Context, name, connectionURI string, options ...option.MongoDBIntegrationOption) (openapi.Integration, error)
func (*RockClient) CreateQueryLambda ¶ added in v0.12.4
func (rc *RockClient) CreateQueryLambda(ctx context.Context, workspace, name, sql string, options ...option.CreateQueryLambdaOption) (openapi.QueryLambdaVersion, error)
CreateQueryLambda creates a new query lambda.
func (*RockClient) CreateQueryLambdaTag ¶ added in v0.12.4
func (rc *RockClient) CreateQueryLambdaTag(ctx context.Context, workspace, name, version, tag string) (openapi.QueryLambdaTag, error)
CreateQueryLambdaTag creates a new tag for a specific query lambda version, or update the tag if it already exists. Note that the tag propagation takes time, and the wait.UntilQueryLambdaTagPropagated() method should be called after updating an existing tag, to avoid eventual consistency issues.
If strong consistency of the version is required when executing a query lambda, option.WithVersion() must be used, e.g.
r, err := rc.ExecuteQueryLambda(ctx, ws, ql, option.WithVersion("f79fc3eae5c823bb"))
https://docs.rockset.com/documentation/reference/createquerylambdatag
func (*RockClient) CreateRole ¶ added in v0.14.3
func (rc *RockClient) CreateRole(ctx context.Context, roleName string, options ...option.RoleOption) (openapi.Role, error)
CreateRole creates a new role
REST API documentation https://docs.rockset.com/rest-api/#createrole
func (*RockClient) CreateS3Collection ¶ added in v0.11.0
func (rc *RockClient) CreateS3Collection(ctx context.Context, workspace, name, description, integration, bucket, pattern string, format option.Format, options ...option.CollectionOption) (openapi.Collection, error)
CreateS3Collection creates an S3 collection from an existing S3 integration. Not specifying a format will default to JSON. Deprecated: use CreateCollection() with option.WithS3Source() instead.
func (*RockClient) CreateS3Integration ¶ added in v0.11.0
func (rc *RockClient) CreateS3Integration(ctx context.Context, name string, creds option.AWSCredentialsFn, options ...option.S3IntegrationOption) (openapi.Integration, error)
func (*RockClient) CreateScheduledLambda ¶ added in v0.24.2
func (rc *RockClient) CreateScheduledLambda(ctx context.Context, workspace, apikey string, cronString string, qlName string, options ...option.ScheduledLambdaOption) (openapi.ScheduledLambda, error)
CreateScheduledLambda creates a new scheduled lambda, with optional arguments.
REST API documentation https://docs.rockset.com/documentation/reference/createscheduledlambda
func (*RockClient) CreateUser ¶ added in v0.12.0
func (rc *RockClient) CreateUser(ctx context.Context, email string, roles []string) (openapi.User, error)
CreateUser creates a new user.
REST API documentation https://docs.rockset.com/rest-api/#createuser
func (*RockClient) CreateView ¶ added in v0.14.1
func (rc *RockClient) CreateView(ctx context.Context, workspace, view, query string, options ...option.ViewOption) (openapi.View, error)
CreateView creates a new view, with an optional description.
REST API documentation https://docs.rockset.com/rest-api/#createview
func (*RockClient) CreateVirtualInstance ¶ added in v0.18.0
func (rc *RockClient) CreateVirtualInstance(ctx context.Context, name string, options ...option.VirtualInstanceOption) (openapi.VirtualInstance, error)
CreateVirtualInstance creates a new virtual instance. Note that not supplying option.WithMountRefreshInterval() or option.WithContinuousMountRefresh() will create a virtual instance that will never refresh the mounts.
REST API documentation https://rockset.com/docs/rest-api/#createvirtualinstance
func (*RockClient) CreateWorkspace ¶ added in v0.9.1
func (rc *RockClient) CreateWorkspace(ctx context.Context, workspace string, options ...option.WorkspaceOption) (openapi.Workspace, error)
CreateWorkspace creates a new workspace, with an optional description.
REST API documentation https://docs.rockset.com/rest-api/#createworkspace
func (*RockClient) DeleteAPIKey ¶ added in v0.12.0
func (rc *RockClient) DeleteAPIKey(ctx context.Context, keyName string, options ...option.APIKeyOption) error
DeleteAPIKey deletes an API key. An admin can delete an api key for another user with option.ForUser().
REST API documentation https://docs.rockset.com/rest-api/#deleteapikey
func (*RockClient) DeleteAlias ¶ added in v0.12.0
func (rc *RockClient) DeleteAlias(ctx context.Context, workspace, alias string) error
DeleteAlias deletes an alias.
REST API documentation https://docs.rockset.com/rest-api/#deletealias
func (*RockClient) DeleteCollection ¶ added in v0.11.0
func (rc *RockClient) DeleteCollection(ctx context.Context, workspace, name string) error
DeleteCollection deletes a collection.
func (*RockClient) DeleteDocuments ¶ added in v0.12.0
func (rc *RockClient) DeleteDocuments(ctx context.Context, workspace, collection string, docIDs []string) ([]openapi.DocumentStatus, error)
DeleteDocuments deletes documents from a collection
REST API documentation https://docs.rockset.com/rest-api/#deletedocuments
func (*RockClient) DeleteDocumentsWithOffset ¶ added in v0.23.0
func (rc *RockClient) DeleteDocumentsWithOffset(ctx context.Context, workspace, collection string, docIDs []string) (openapi.DeleteDocumentsResponse, error)
DeleteDocumentsWithOffset deletes documents from a collection, and returns the response with the offset(s), which can be used to wait until the collection has been updated to include the specified offset(s).
response, err := rs.DeleteDocumentsWithOffset(ctx, "commons", "users", docIDs) if err != nil { return err } w := wait.New(rs) err = w.UntilQueryable(ctx, "commons", "users", []string{response.GetLastOffset()})
The added documents are now queryable in the collection.
func (*RockClient) DeleteIntegration ¶ added in v0.11.0
func (rc *RockClient) DeleteIntegration(ctx context.Context, name string) error
func (*RockClient) DeleteQueryLambda ¶ added in v0.12.4
func (rc *RockClient) DeleteQueryLambda(ctx context.Context, workspace, name string) error
DeleteQueryLambda deletes a query lambda.
func (*RockClient) DeleteQueryLambdaTag ¶ added in v0.12.4
func (rc *RockClient) DeleteQueryLambdaTag(ctx context.Context, workspace, name, tag string) error
DeleteQueryLambdaTag deletes a query lambda tag.
func (*RockClient) DeleteQueryLambdaVersion ¶ added in v0.12.4
func (rc *RockClient) DeleteQueryLambdaVersion(ctx context.Context, workspace, name, version string) error
DeleteQueryLambdaVersion deletes a query lambda version.
func (*RockClient) DeleteRole ¶ added in v0.14.3
func (rc *RockClient) DeleteRole(ctx context.Context, roleName string) error
DeleteRole deletes a role.
REST API documentation https://docs.rockset.com/rest-api/#deleterole
func (*RockClient) DeleteScheduledLambda ¶ added in v0.24.2
func (rc *RockClient) DeleteScheduledLambda(ctx context.Context, workspace, scheduledLambdaRRN string) error
DeleteScheduledLambda marks the scheduled lambda for deletion, which will take place in the background. Use the WaitUntilScheduledLambdaGone() call to block until the scheduled lambda has been deleted.
REST API documentation https://docs.rockset.com/documentation/reference/deletescheduledlambda
func (*RockClient) DeleteUser ¶ added in v0.12.0
func (rc *RockClient) DeleteUser(ctx context.Context, email string) error
DeleteUser deletes a user.
REST API documentation https://docs.rockset.com/rest-api/#deleteuser
func (*RockClient) DeleteView ¶ added in v0.14.1
func (rc *RockClient) DeleteView(ctx context.Context, workspace, view string) error
DeleteView marks the view for deletion, which will take place in the background. Use the WaitUntilViewGone() call to block until the view has been deleted.
REST API documentation https://docs.rockset.com/rest-api/#deleteview
func (*RockClient) DeleteVirtualInstance ¶ added in v0.18.0
func (rc *RockClient) DeleteVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
DeleteVirtualInstance deletes a virtual instance.
REST API documentation https://rockset.com/docs/rest-api/#deletevirtualinstance
func (*RockClient) DeleteWorkspace ¶ added in v0.9.1
func (rc *RockClient) DeleteWorkspace(ctx context.Context, name string) error
DeleteWorkspace deletes a workspace.
REST API documentation https://docs.rockset.com/rest-api/#deleteworkspace
func (*RockClient) ExecuteQueryLambda ¶ added in v0.11.0
func (rc *RockClient) ExecuteQueryLambda(ctx context.Context, workspace, name string, options ...option.QueryLambdaOption) (openapi.QueryResponse, error)
ExecuteQueryLambda executes a query lambda with optional query options. If neither option.WithTag() nor option.WithVersion() is used, it makes the call using option.WithTag(LatestTag)
If strong consistency of the version is required when executing a query lambda, option.WithVersion() must be used, e.g.
r, err := rc.ExecuteQueryLambda(ctx, ws, ql, option.WithVersion("f79fc3eae5c823bb"))
https://docs.rockset.com/documentation/reference/executequerylambdabytag https://docs.rockset.com/documentation/reference/executequerylambda
func (*RockClient) ExecuteQueryOnVirtualInstance ¶ added in v0.18.0
func (rc *RockClient) ExecuteQueryOnVirtualInstance(ctx context.Context, vID string, sql string, options ...option.QueryOption) (openapi.QueryResponse, error)
ExecuteQueryOnVirtualInstance executes the SQL query on a specific virtual instance instead of the main virtual instance.
REST API documentation https://rockset.com/docs/rest-api/#queryvirtualinstance
func (*RockClient) GetAPIKey ¶ added in v0.12.0
func (rc *RockClient) GetAPIKey(ctx context.Context, name string, options ...option.APIKeyOption) (openapi.ApiKey, error)
GetAPIKey gets the named API key. An admin can get an api key for another user with option.ForUser().
REST API documentation https://docs.rockset.com/rest-api/#getapikey
func (*RockClient) GetAlias ¶ added in v0.12.0
GetAlias gets an alias
REST API documentation https://docs.rockset.com/rest-api/#getalias
func (*RockClient) GetCollection ¶ added in v0.11.0
func (rc *RockClient) GetCollection(ctx context.Context, workspace, name string) (openapi.Collection, error)
GetCollection gets information about a collection.
func (*RockClient) GetCollectionCommit ¶ added in v0.23.0
func (rc *RockClient) GetCollectionCommit(ctx context.Context, workspace, name string, offsets []string) (openapi.GetCollectionCommitData, error)
GetCollectionCommit determines if the collection includes data at or after the specified fence(s) for close read-after-write semantics.
func (*RockClient) GetCollectionMount ¶ added in v0.18.0
func (rc *RockClient) GetCollectionMount(ctx context.Context, vID, collectionPath string) (openapi.CollectionMount, error)
GetCollectionMount gets a mount on this virtual instance.
REST API documentation https://rockset.com/docs/rest-api/#getcollectionmount
func (*RockClient) GetCurrentUser ¶ added in v0.12.0
GetCurrentUser gets the current user.
REST API documentation https://docs.rockset.com/rest-api/#getcurrentuser
func (*RockClient) GetIntegration ¶ added in v0.12.3
func (rc *RockClient) GetIntegration(ctx context.Context, name string) (openapi.Integration, error)
func (*RockClient) GetOrganization ¶ added in v0.12.0
func (rc *RockClient) GetOrganization(ctx context.Context) (openapi.Organization, error)
GetOrganization gets the current organization.
func (*RockClient) GetQueryInfo ¶ added in v0.15.0
GetQueryInfo retrieves information about a query.
func (*RockClient) GetQueryLambdaVersion ¶ added in v0.12.3
func (rc *RockClient) GetQueryLambdaVersion(ctx context.Context, workspace, name, version string) (openapi.QueryLambdaVersion, error)
GetQueryLambdaVersion get the query lambda information for a specific version.
func (*RockClient) GetQueryLambdaVersionByTag ¶ added in v0.12.3
func (rc *RockClient) GetQueryLambdaVersionByTag(ctx context.Context, workspace, name, tag string) (openapi.QueryLambdaTag, error)
GetQueryLambdaVersionByTag gets the query lambda version for a tag.
func (*RockClient) GetQueryResults ¶ added in v0.15.0
func (rc *RockClient) GetQueryResults(ctx context.Context, queryID string, options ...option.QueryResultOption) (openapi.QueryPaginationResponse, error)
GetQueryResults retrieves the results of a completed async query.
func (*RockClient) GetRole ¶ added in v0.14.4
GetRole retrieve a role.
REST API documentation https://docs.rockset.com/rest-api/#getrole
func (*RockClient) GetScheduledLambda ¶ added in v0.24.2
func (rc *RockClient) GetScheduledLambda(ctx context.Context, workspace, scheduledLambdaRRN string) (openapi.ScheduledLambda, error)
GetScheduledLambda gets details about a scheduled lambda.
REST API documentation https://docs.rockset.com/documentation/reference/getscheduledlambda
func (*RockClient) GetUser ¶ added in v0.15.0
GetUser gets a user.
REST API documentation https://docs.rockset.com/rest-api/#getuser
func (*RockClient) GetView ¶ added in v0.14.1
GetView gets details about a view.
REST API documentation https://docs.rockset.com/rest-api/#getview
func (*RockClient) GetVirtualInstance ¶ added in v0.12.0
func (rc *RockClient) GetVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
GetVirtualInstance gets a virtual instance by the virtual instance uuid.
REST API documentation https://docs.rockset.com/rest-api/#getvirtualinstance
func (*RockClient) GetWorkspace ¶ added in v0.9.1
func (rc *RockClient) GetWorkspace(ctx context.Context, workspace string) (openapi.Workspace, error)
GetWorkspace gets a workspace.
REST API documentation https://docs.rockset.com/rest-api/#getworkspace
func (*RockClient) ListAPIKeys ¶ added in v0.12.0
func (rc *RockClient) ListAPIKeys(ctx context.Context, options ...option.APIKeyOption) ([]openapi.ApiKey, error)
ListAPIKeys list API keys. An admin can list api keys for another user with option.ForUser().
REST API documentation https://docs.rockset.com/rest-api/#listapikey
func (*RockClient) ListActiveQueries ¶ added in v0.15.0
ListActiveQueries lists all active queries, i.e. queued or running.
func (*RockClient) ListAliases ¶ added in v0.12.0
func (rc *RockClient) ListAliases(ctx context.Context, options ...option.ListAliasesOption) ([]openapi.Alias, error)
ListAliases lists all aliases for the organization, or for a workspace when using the option.WithAliasWorkspace() option.
REST API documentation https://docs.rockset.com/rest-api/#listalias
func (*RockClient) ListCollectionMounts ¶ added in v0.18.0
func (rc *RockClient) ListCollectionMounts(ctx context.Context, vID string) ([]openapi.CollectionMount, error)
ListCollectionMounts lists collection mounts for a particular virtual instance.
REST API documentation https://rockset.com/docs/rest-api/#listcollectionmounts
func (*RockClient) ListCollections ¶ added in v0.12.3
func (rc *RockClient) ListCollections(ctx context.Context, options ...option.ListCollectionOption) ([]openapi.Collection, error)
ListCollections lists all collections, or in a specific workspace is option.WithWorkspace() is used.
func (*RockClient) ListIntegrations ¶ added in v0.12.3
func (rc *RockClient) ListIntegrations(ctx context.Context) ([]openapi.Integration, error)
func (*RockClient) ListQueryLambdaTags ¶ added in v0.12.3
func (rc *RockClient) ListQueryLambdaTags(ctx context.Context, workspace, queryLambda string) ([]openapi.QueryLambdaTag, error)
ListQueryLambdaTags lists all tags for a query lambda.
func (*RockClient) ListQueryLambdaVersions ¶ added in v0.12.3
func (rc *RockClient) ListQueryLambdaVersions(ctx context.Context, workspace, name string) ([]openapi.QueryLambdaVersion, error)
ListQueryLambdaVersions lists all versions for a query lambda.
func (*RockClient) ListQueryLambdas ¶ added in v0.12.3
func (rc *RockClient) ListQueryLambdas(ctx context.Context, options ...option.ListQueryLambdaOption) ([]openapi.QueryLambda, error)
ListQueryLambdas lists all query lambdas, unless the option.WithQueryLambdaWorkspace is used.
func (*RockClient) ListRoles ¶ added in v0.14.3
ListRoles list all roles.
REST API documentation https://docs.rockset.com/rest-api/#listroles
func (*RockClient) ListUsers ¶ added in v0.12.0
ListUsers lists all users.
REST API documentation https://docs.rockset.com/rest-api/#listusers
func (*RockClient) ListViews ¶ added in v0.14.1
func (rc *RockClient) ListViews(ctx context.Context, options ...option.ListViewOption) ([]openapi.View, error)
ListViews list views. Use option.WithViewWorkspace() to limit the request to just one workspace.
REST API documentation https://docs.rockset.com/rest-api/#listviews
func (*RockClient) ListVirtualInstanceQueries ¶ added in v0.21.2
func (rc *RockClient) ListVirtualInstanceQueries(ctx context.Context, vID string) ([]openapi.QueryInfo, error)
ListVirtualInstanceQueries lists actively queued and running queries for a particular Virtual Instance.
REST API documentation
func (*RockClient) ListVirtualInstances ¶ added in v0.12.0
func (rc *RockClient) ListVirtualInstances(ctx context.Context) ([]openapi.VirtualInstance, error)
ListVirtualInstances lists all virtual instances.
REST API documentation https://docs.rockset.com/rest-api/#listvirtualinstances
func (*RockClient) ListWorkspaces ¶ added in v0.9.1
ListWorkspaces list all workspaces.
REST API documentation https://docs.rockset.com/rest-api/#listworkspaces
func (*RockClient) MountCollections ¶ added in v0.21.2
func (rc *RockClient) MountCollections(ctx context.Context, vID string, collectionPaths []string) ([]openapi.CollectionMount, error)
MountCollections mounts collections on a virtual instance, where the collections are listed as workspace.collection.
REST API documentation https://rockset.com/docs/rest-api/#mountcollection
func (*RockClient) PatchDocuments ¶ added in v0.12.0
func (rc *RockClient) PatchDocuments(ctx context.Context, workspace, collection string, patches []PatchDocument) ([]openapi.DocumentStatus, error)
PatchDocuments patches (updates) existing documents in a collection. This convenience method does not use the generated client, as it takes values as map[string]interface{} which doesn't work when you want to patch e.g. a top-level boolean value.
REST API documentation https://docs.rockset.com/rest-api/#patchdocuments
func (*RockClient) Ping ¶ added in v0.13.0
func (rc *RockClient) Ping(ctx context.Context) error
Ping connects to the Rockset API server and can be used to verify connectivity. It does not require authentication, so to test that use the GetOrganization() method instead.
func (*RockClient) Query ¶
func (rc *RockClient) Query(ctx context.Context, sql string, options ...option.QueryOption) (openapi.QueryResponse, error)
Query executes a sql query with optional option.QueryOption. If you want to execute the query on a specific virtual instance instead of the main virtual instance, either add the option.WithVirtualInstance() option, or use ExecuteQueryOnVirtualInstance() method.
result, err := rc.Query(ctx, "SELECT * FROM _commons._events", option.WithVirtualInstance(vID)
func (*RockClient) ResumeVirtualInstance ¶ added in v0.18.0
func (rc *RockClient) ResumeVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
ResumeVirtualInstance resumes a virtual instance.
REST API documentation https://docs.rockset.com/rest-api/#resumevirtualinstance
func (*RockClient) SuspendVirtualInstance ¶ added in v0.18.0
func (rc *RockClient) SuspendVirtualInstance(ctx context.Context, vID string) (openapi.VirtualInstance, error)
SuspendVirtualInstance suspends a virtual instance.
REST API documentation https://docs.rockset.com/rest-api/#suspendvirtualinstance
func (*RockClient) UnmountCollection ¶ added in v0.18.0
func (rc *RockClient) UnmountCollection(ctx context.Context, vID string, collectionPath string) (openapi.CollectionMount, error)
UnmountCollection unmount a collection from a virtual instance.
REST API documentation https://rockset.com/docs/rest-api/#unmountcollection
func (*RockClient) UpdateAPIKey ¶ added in v0.15.0
func (rc *RockClient) UpdateAPIKey(ctx context.Context, keyName string, options ...option.APIKeyOption) (openapi.ApiKey, error)
UpdateAPIKey updates the state of an API key. An admin can update an api key for another user with option.ForUser().
REST API documentation https://rockset.com/docs/rest-api/#updateapikey
func (*RockClient) UpdateAlias ¶ added in v0.12.0
func (rc *RockClient) UpdateAlias(ctx context.Context, workspace, alias string, collections []string, options ...option.AliasOption) error
UpdateAlias updates an alias
REST API documentation https://docs.rockset.com/rest-api/#updatealias
func (*RockClient) UpdateCollection ¶ added in v0.18.0
func (rc *RockClient) UpdateCollection(ctx context.Context, workspace, name string, options ...option.CollectionOption) (openapi.Collection, error)
UpdateCollection updates a collection. Only the option.WithCollectionDescription and option.WithIngestTransformation can be used, and any other option will return an error.
func (*RockClient) UpdateQueryLambda ¶ added in v0.12.4
func (rc *RockClient) UpdateQueryLambda(ctx context.Context, workspace, name, sql string, options ...option.CreateQueryLambdaOption) (openapi.QueryLambdaVersion, error)
UpdateQueryLambda updates an existing query lambda.
func (*RockClient) UpdateRole ¶ added in v0.14.3
func (rc *RockClient) UpdateRole(ctx context.Context, roleName string, options ...option.RoleOption) (openapi.Role, error)
UpdateRole updates a role.
REST API documentation https://docs.rockset.com/rest-api/#updaterole
func (*RockClient) UpdateScheduledLambda ¶ added in v0.24.2
func (rc *RockClient) UpdateScheduledLambda(ctx context.Context, workspace string, scheduledLambdaRRN string, options ...option.ScheduledLambdaOption) (openapi.ScheduledLambda, error)
UpdateScheduledLambda updates an existing scheduled lambda, with optional arguments.
REST API documentation https://docs.rockset.com/documentation/reference/updatescheduledlambda
func (*RockClient) UpdateUser ¶ added in v0.15.1
func (rc *RockClient) UpdateUser(ctx context.Context, email string, roles []string, options ...option.UserOption) (openapi.User, error)
UpdateUser updates as existing user. Note that the user first and last name aren't visible for privacy reasons, until the user has accepted the invite, i.e. is in the ACTIVE state.
REST API documentation https://docs.rockset.com/rest-api/#updateuser
func (*RockClient) UpdateView ¶ added in v0.14.1
func (rc *RockClient) UpdateView(ctx context.Context, workspace, view, query string, options ...option.ViewOption) (openapi.View, error)
UpdateView updates an existing view, with an optional description.
REST API documentation https://docs.rockset.com/rest-api/#updateview
func (*RockClient) UpdateVirtualInstance ¶ added in v0.12.0
func (rc *RockClient) UpdateVirtualInstance(ctx context.Context, vID string, options ...option.VirtualInstanceOption) (openapi.VirtualInstance, error)
UpdateVirtualInstance updates the properties of a virtual instance.
REST API documentation https://docs.rockset.com/rest-api/#setvirtualinstance
func (*RockClient) ValidateQuery ¶ added in v0.11.0
func (rc *RockClient) ValidateQuery(ctx context.Context, sql string, options ...option.QueryOption) (openapi.ValidateQueryResponse, error)
ValidateQuery validates a sql query with optional option.QueryOption
type RockConfig ¶ added in v0.12.0
type RockConfig struct { // Retrier is the retry function used to retry API calls. retry.Retrier // Wait is the helper to wait for resources Wait *wait.Waiter // APIKey is the API key to use for authentication APIKey string // APIServer is the API server to connect to APIServer string // Token is an OAuth2 ID token Token string // Organization is the Rockset org, which is required when authenticating using Token Organization string APIClient *openapi.APIClient // contains filtered or unexported fields }
RockConfig contains the configurable options for the RockClient.
type RockOption ¶ added in v0.8.0
type RockOption func(rc *RockConfig)
RockOption is the type for RockClient options.
func WithAPIClient ¶ added in v0.22.6
func WithAPIClient(c *openapi.APIClient) RockOption
WithAPIClient sets the openapi.APIClient to use, which can be used in testing to use a fake client.
f := fake.NewAPIClient() rc, err := rockset.NewRockClient(rockset.WithAPIClient(f)
func WithAPIKey ¶ added in v0.8.0
func WithAPIKey(apiKey string) RockOption
WithAPIKey sets the API key to use, and removes the bearer token.
func WithAPIServer ¶ added in v0.8.0
func WithAPIServer(server string) RockOption
WithAPIServer sets the API server to connect to, and override the ROCKSET_APISERVER.
func WithBearerToken ¶ added in v0.22.1
func WithBearerToken(token, org string) RockOption
WithBearerToken uses authorization using a bearer token, which requires specifying the organization. Removes the API key, if set.
func WithCustomHeader ¶ added in v0.21.2
func WithCustomHeader(key, value string) RockOption
WithCustomHeader sets a custom HTTP header for all Rockset API calls.
func WithHTTPClient ¶ added in v0.8.0
func WithHTTPClient(c *http.Client) RockOption
WithHTTPClient sets the HTTP client. Without this option RockClient uses the http.DefaultClient.
func WithHTTPDebug ¶ added in v0.12.0
func WithHTTPDebug() RockOption
WithHTTPDebug adds a http.RoundTripper that logs the request and response.
func WithRetry ¶ added in v0.12.0
func WithRetry(r retry.Retrier) RockOption
WithRetry sets the Retrier the RockClient uses to retry requests which return an Error that can be retried. The errors which can be retried are configurable using the Exponential field RetryableErrorCheck.
exp := rockset.Exponential{ RetryableErrorCheck: func(err error) bool { return error.Is(err, io.ErrUnexpectedEOF) } } rc, err := rockset.NewClient(rockset.WithRetry(exp)) // handle error err = rc.Retry(ctx, func() error{ // call that will be retried if it returns io.ErrUnexpectedEOF })
This would retry all io.ErrUnexpectedEOF errors
func WithUserAgent ¶ added in v0.15.1
func WithUserAgent(name string) RockOption
WithUserAgent sets the user agent string. Used by the Rockset terraform provider. If not set, it defaults to DefaultUserAgent.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
internal
|
|
Package option contains optional arguments for rockset.RockClient convenience methods.
|
Package option contains optional arguments for rockset.RockClient convenience methods. |
fake
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
fake
Code generated by counterfeiter.
|
Code generated by counterfeiter. |