Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package batch is used for interacting with the Batch platform's API. This backend is a non-traditional backend and does not implement the Backend interface; it should be used independently.
Index ¶
- Constants
 - type AuthResponse
 - type Batch
 - func (b *Batch) ArchiveReplay() error
 - func (b *Batch) Authenticate(username, password string) (*AuthResponse, error)
 - func (b *Batch) CreateCollection() error
 - func (b *Batch) CreateDestination(dstType string) error
 - func (b *Batch) CreateReplay() error
 - func (b *Batch) Delete(path string) ([]byte, int, error)
 - func (b *Batch) Get(path string, queryParams map[string]string) ([]byte, int, error)
 - func (b *Batch) ListCollections() error
 - func (b *Batch) ListDestinations() error
 - func (b *Batch) ListReplays() error
 - func (b *Batch) ListSchemas() error
 - func (b *Batch) Login() error
 - func (b *Batch) Logout() error
 - func (b *Batch) Post(path string, params map[string]interface{}) ([]byte, int, error)
 - func (b *Batch) SearchCollection() error
 
- type BlunderError
 - type BlunderErrorResponse
 - type Collection
 - type CollectionOutput
 - type CollectionSchema
 - type DataLake
 - type DestinationOutput
 - type IBatch
 - type PrinterFunc
 - type Replay
 - type ReplayCollection
 - type ReplayDestination
 - type ReplayOutput
 - type SchemaOutput
 - type SearchResult
 
Constants ¶
const ( EnterKey = byte(10) PageSize = 25 )
const (
	DefaultAPIURL = "https://api.batch.sh"
)
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResponse ¶
type AuthResponse struct {
	AccountID             string `json:"id"`
	Name                  string `json:"name"`
	Email                 string `json:"email"`
	OnboardingState       string `json:"onboarding_state"`
	OnboardingStateStatus string `json:"onboarding_state_status"`
	Team                  struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	}
}
    AuthResponse is used to unmarshal the JSON results of a login API call
type Batch ¶
type Batch struct {
	PersistentConfig *config.Config
	Log              *logrus.Entry
	Opts             *opts.CLIOptions
	Client           *http.Client
	Printer          PrinterFunc
	ApiUrl           string
}
    func New ¶
func New(cliOpts *opts.CLIOptions, cfg *config.Config) *Batch
New creates a new instance of a Batch struct with defaults
func (*Batch) ArchiveReplay ¶ added in v0.25.1
ArchiveReplay archives a replay
func (*Batch) Authenticate ¶
func (b *Batch) Authenticate(username, password string) (*AuthResponse, error)
Authenticate makes an API call to the Batch.sh API with the given account's credentials
func (*Batch) CreateCollection ¶
func (*Batch) CreateDestination ¶
func (*Batch) CreateReplay ¶
func (*Batch) ListCollections ¶
ListCollections lists all of an account's collections
func (*Batch) ListDestinations ¶
ListDestinations lists all of an account's replay destinations
func (*Batch) ListReplays ¶
ListReplays lists all of an account's replays
func (*Batch) ListSchemas ¶
ListSchemas lists all of an account's schemas
func (*Batch) Login ¶
Login attempts to login to the Batch.sh API using credentials supplied via stdin
func (*Batch) SearchCollection ¶
SearchCollection queries a collection
type BlunderError ¶
type BlunderErrorResponse ¶
type BlunderErrorResponse struct {
	Errors []*BlunderError `json:"errors"`
}
    type Collection ¶
type Collection struct {
	ID                string `json:"id" header:"ID"`
	Name              string `json:"name" header:"Name"`
	Token             string `json:"token"`
	Paused            bool   `json:"paused" header:"Is Paused?"`
	Archived          bool   `json:"archived" header:"Archived"`
	*CollectionSchema `json:"schema"`
}
    Collection is used to unmarshal the JSON results of a list collections API call
type CollectionOutput ¶
type CollectionOutput struct {
	Name       string `header:"Name" json:"name"`
	ID         string `header:"ID" json:"id"`
	Token      string `header:"Token" json:"token"`
	Paused     bool   `header:"Is Paused" json:"paused"`
	Archived   bool   `header:"Archived" json:"archived"`
	SchemaName string `header:"Schema Name" json:"schema_name"`
	SchemaType string `header:"Schema Type" json:"schema_type"`
}
    CollectionOutput is used for displaying collections as a table
type CollectionSchema ¶
type CollectionSchema struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name" header:"Schema"`
	Type string `json:"type"`
}
    CollectionSchema is used to unmarshal the JSON results of a list collections API call
type DestinationOutput ¶
type DestinationOutput struct {
	Name     string `json:"name" header:"Name"`
	ID       string `json:"id" header:"Destination ID"`
	Type     string `json:"type" header:"Type"`
	Archived bool   `json:"archived" header:"Is Archived"`
}
    DestinationOutput is used for displaying destinations as a table
type IBatch ¶
type IBatch interface {
	LoadConfig()
	Login() error
	Logout() error
	ListReplays() error
	ListCollections() error
	ListSchemas() error
	ListDestinations() error
	Get(path string, queryParams map[string]string) (content []byte, statusCode int, err error)
	Post(path string, params map[string]interface{}) (content []byte, statusCode int, err error)
	Delete(path string) (content []byte, statusCode int, err error)
}
    type PrinterFunc ¶
type PrinterFunc func(v interface{})
    PrinterFunc is a function that will be used to display output to the user's console
type Replay ¶
type Replay struct {
	ID                 string `header:"Replay ID" json:"id"`
	Name               string `header:"Name" json:"name"`
	Type               string `header:"Type" json:"type"`
	Query              string `header:"Query" json:"query"`
	Paused             bool   `header:"Is Paused" json:"paused"`
	Archived           bool   `header:"Archived" json:"archived"`
	Status             string `header:"Status" json:"status"`
	*ReplayDestination `json:"destination"`
	*ReplayCollection  `json:"collection"`
}
    Replay is used to unmarshal the JSON results of a list replays API call
type ReplayCollection ¶
type ReplayCollection struct {
	Name string `db:"collection_name" json:"name"`
}
    ReplayCollection is used to unmarshal the JSON results of a list replays API call
type ReplayDestination ¶
type ReplayDestination struct {
	Name string `db:"destination_name" json:"name"`
}
    ReplayDestination is used to unmarshal the JSON results of a list replays API call
type ReplayOutput ¶
type ReplayOutput struct {
	Name        string `header:"Name" json:"name"`
	ID          string `header:"Replay ID" json:"id"`
	Type        string `header:"Type" json:"type"`
	Query       string `header:"Query" json:"query"`
	Collection  string `header:"Collection Name"`
	Destination string `header:"Destination Name"`
	Paused      bool   `header:"Is Paused" json:"paused"`
	Status      string `header:"Status" json:"status"`
}
    ReplayOutput is used for displaying replays as a table
type SchemaOutput ¶
type SchemaOutput struct {
	Name     string `header:"Name" json:"name"`
	ID       string `header:"Schema ID" json:"id"`
	Type     string `header:"Type" json:"type"`
	RootType string `header:"Protobuf Root Type" json:"root_type"`
	Archived bool   `header:"Is Archived" json:"archived"`
}
    SchemaOutput is used for displaying schemas as a table
type SearchResult ¶
type SearchResult struct {
	Total int               `json:"total"`
	Data  []json.RawMessage `json:"data"`
}
    SearchResult is used to unmarshal the JSON results of a search API call