package command

import "github.com/datastax/astra-db-go/v2/astra/internal/command"

Index

Variables

var (
	ErrCmdNilDb = errors.New("command cannot execute with nil Db")
)

Functions

func ExtractDevOpsError

func ExtractDevOpsError(statusCode int, body []byte) error

ExtractDevOpsError handles error responses from the DevOps API.

Types

type DataAPI

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

DataAPI represents a command to be executed against the astra DB.

func NewDataAPIAdminCommand
func NewDataAPIAdminCommand(endpoint, resourceName, name string, payload any, target serdes.Target, opts *options.APIOptions) DataAPI
func NewDataAPICommand
func NewDataAPICommand(endpoint, resourceName, name string, payload any, target serdes.Target, opts *options.APIOptions) DataAPI
func (*DataAPI) ApiVersion
func (c *DataAPI) ApiVersion() string

ApiVersion returns the Data API version to use for this command.

func (*DataAPI) Execute
func (c *DataAPI) Execute(ctx context.Context) ([]byte, results.Warnings, serdes.TargetDecodeCtx, error)

Execute a command against the astra DB web API.

func (*DataAPI) ExtractErrors
func (c *DataAPI) ExtractErrors(statusCode int, body []byte, opts *options.APIOptions) ([]byte, results.Warnings, serdes.TargetDecodeCtx, error)
func (*DataAPI) Keyspace
func (c *DataAPI) Keyspace() string

Keyspace returns the keyspace to use for this command.

func (DataAPI) MarshalAstraRaw
func (c DataAPI) MarshalAstraRaw(ctx serdes.EncodeCtx, dst []byte) ([]byte, error)
func (*DataAPI) ResolveOptions
func (c *DataAPI) ResolveOptions() *options.APIOptions

ResolveOptions returns the final resolved options.

func (*DataAPI) URL
func (c *DataAPI) URL() string

type DevOpsAPI

type DevOpsAPI struct {
	// contains filtered or unexported fields
}
func NewDevOpsAPICommand
func NewDevOpsAPICommand(endpoint, apiVersion, path, method string, payload any, params url.Values, opts *options.APIOptions) *DevOpsAPI
func (*DevOpsAPI) Execute
func (ac *DevOpsAPI) Execute(ctx context.Context) (*DevOpsResponse, error)
func (*DevOpsAPI) URL
func (ac *DevOpsAPI) URL() string

type DevOpsResponse

type DevOpsResponse struct {
	Body       []byte
	Headers    http.Header
	StatusCode int
}

DevOpsResponse holds the response from an admin command execution.