hybrik

package module
v0.0.0-...-7470a22 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

hybrik-sdk-go

Early stage Hybrik SDK for the Go programming language. The SDK interfaces are still subject to breaking changes. Please plan accordingly.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoOAPIKey is the error for zero value config OAPIKey
	ErrNoOAPIKey = errors.New("no oapi key provided")
	// ErrNoOAPISecret is the error for zero value config OAPISecret
	ErrNoOAPISecret = errors.New("no oapi secret provided")
	// ErrNoAuthKey is the error for zero value config AuthKey
	ErrNoAuthKey = errors.New("no auth key provided")
	// ErrNoAuthSecret is the error for zero value config AuthSecret
	ErrNoAuthSecret = errors.New("no auth secret provided")
	// ErrNoAPIURL is the error for zero value config API URL
	ErrNoAPIURL = errors.New("no api url provided")
	// ErrNoComplianceDate is the error for zero value config ComplianceDate
	ErrNoComplianceDate = errors.New("no compliance date provided")

	// ErrInvalidComplianceDate is the error for an invalid compliance date provided
	ErrInvalidComplianceDate = errors.New("provided compliance date is invalid. Expected format: 'YYYYMMDD'")

	// ErrInvalidURL is the error for an invalid URL provided
	ErrInvalidURL = errors.New("invalid api url provided")
)
View Source
var (
	// ErrGopSizeNan is an error returned when the GopSize field of db.Preset is not a valid number
	ErrGopSizeNan = fmt.Errorf("bitrate non a number")
)

Functions

This section is empty.

Types

type API

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

API is the implementation of the HybrikAPI methods

func (*API) CallAPI

func (a *API) CallAPI(method string, apiPath string, params url.Values, body io.Reader) (string, error)

CallAPI is the general method to call for access to the API

type APIInterface

type APIInterface interface {
	CallAPI(method string, apiPath string, params url.Values, body io.Reader) (string, error)
	// contains filtered or unexported methods
}

APIInterface is interface for the underlying client object

type AssetPayload

type AssetPayload struct {
	StorageProvider string `json:"storage_provider,omitempty"`

	URL string `json:"url,omitempty"`
}

AssetPayload .

type AudioTarget

type AudioTarget struct {
	Codec      string `json:"codec,omitempty"`
	Channels   int    `json:"channels,omitempty"`
	SampleRate int    `json:"sample_rate,omitempty"`
	SampleSize int    `json:"sample_size,omitempty"`
	BitrateKb  int    `json:"bitrate_kb,omitempty"`
}

type Client

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

Client implements the ClientInterface

func NewClient

func NewClient(config Config) (*Client, error)

NewClient creates an instance of the HybrikAPI client

func (*Client) CallAPI

func (c *Client) CallAPI(method string, apiPath string, params url.Values, body io.Reader) (string, error)

CallAPI can be used to make any GET/POST/PUT/DELETE API call to the Hybrik service

func (*Client) CreatePreset

func (c *Client) CreatePreset(preset Preset) (Preset, error)

CreatePreset creates a new preset

func (*Client) DeletePreset

func (c *Client) DeletePreset(presetID string) error

DeletePreset removes a preset based on its presetID

func (*Client) GetJobInfo

func (c *Client) GetJobInfo(jobID string) (JobInfo, error)

GetJobInfo takes a jobID and obtains basic status details about the corresponding job

func (*Client) GetPreset

func (c *Client) GetPreset(presetID string) (Preset, error)

GetPreset return details of a given presetID

func (*Client) QueueJob

func (c *Client) QueueJob(jobJSON string) (string, error)

QueueJob takes a hybrik job json and submits a new job

func (*Client) StopJob

func (c *Client) StopJob(jobID string) error

StopJob takes a jobID and deletes is from Hybrik

type ClientInterface

type ClientInterface interface {
	// Generic
	CallAPI(method string, apiPath string, params url.Values, body io.Reader) (string, error)

	// Jobs API
	QueueJob(string) (string, error)
	GetJobInfo(string) (JobInfo, error)
	StopJob(string) error

	// Presets API
	GetPreset(string) (Preset, error)
	CreatePreset(Preset) (Preset, error)
	DeletePreset(string) error
}

ClientInterface is an interface for commonly used API calls

type Config

type Config struct {
	URL            string
	ComplianceDate string
	OAPIKey        string
	OAPISecret     string
	AuthKey        string
	AuthSecret     string
	OAPIURL        string
}

Config represents the configuration params that are necessary for the API calls to Hybrik to work

type Connection

type Connection struct {
	From []ConnectionFrom `json:"from,omitempty"`
	To   ConnectionTo     `json:"to,omitempty"`
}

Connection .

type ConnectionFrom

type ConnectionFrom struct {
	Element string `json:"element,omitempty"`
}

ConnectionFrom .

type ConnectionTo

type ConnectionTo struct {
	Success []ToSuccess `json:"success,omitempty"`
	Error   []ToError   `json:"error,omitempty"`
}

ConnectionTo .

type CreateJob

type CreateJob struct {
	Name              string           `json:"name"`
	Payload           CreateJobPayload `json:"payload"`
	Schema            string           `json:"schema,omitempty"`
	Expiration        int              `json:"expiration,omitempty"`
	Priority          int              `json:"priority,omitempty"`
	TaskRetryCount    int              `json:"task_retry:count,omitempty"`
	TaskRetryDelaySec int              `json:"task_retry:delay_sec,omitempty"`
	TaskTags          []string         `json:"task_tags,omitempty"`
	UserTag           string           `json:"user_tag,omitempty"`
}

CreateJob .

type CreateJobPayload

type CreateJobPayload struct {
	Elements    []Element    `json:"elements,omitempty"`
	Connections []Connection `json:"connections,omitempty"`
}

CreateJobPayload .

type Element

type Element struct {
	UID     string              `json:"uid"`
	Kind    string              `json:"kind"`
	Task    *ElementTaskOptions `json:"task,omitempty"`
	Preset  *TranscodePreset    `json:"preset,omitempty"`
	Payload interface{}         `json:"payload"` // Can be of type ElementPayload or LocationTargetPayload
}

Element .

type ElementPayload

type ElementPayload struct {
	Kind    string       `json:"kind,omitempty"`
	Payload AssetPayload `json:"payload"`
}

ElementPayload .

type ElementTaskOptions

type ElementTaskOptions struct {
	Name string `json:"name"`
}

ElementTaskOptions .

type ErrCreatePreset

type ErrCreatePreset struct {
	Msg string
}

ErrCreatePreset occurs when there is a problem creating a preset

func (ErrCreatePreset) Error

func (e ErrCreatePreset) Error() string

type ErrGetPreset

type ErrGetPreset struct {
	Msg string
}

ErrGetPreset occurs when there is a problem obtaining a preset

func (ErrGetPreset) Error

func (e ErrGetPreset) Error() string

type ErrNotDeleted

type ErrNotDeleted struct {
	JobID string
}

ErrNotDeleted is the error returned when a job is not successfully deleted from Hybrik

func (ErrNotDeleted) Error

func (e ErrNotDeleted) Error() string

type JobInfo

type JobInfo struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Status    string    `json:"status"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
	Progress  int       `json:"progress"`
}

JobInfo is the GetJobInfo response containing basic details about a job

type LocationTargetPayload

type LocationTargetPayload struct {
	Location TranscodeLocation         `json:"location"`
	Targets  []TranscodeLocationTarget `json:"targets"`
}

LocationTargetPayload .

type ManifestCreatorPayload

type ManifestCreatorPayload struct {
	Location    TranscodeLocation `json:"location"`
	FilePattern string            `json:"file_pattern"`
	Kind        string            `json:"kind"`
	UID         string            `json:"uid,omitempty"`
}

ManifestCreatorPayload .

type Preset

type Preset struct {
	Key         string        `json:"key"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	UserData    string        `json:"user_data,omitempty"`
	Kind        string        `json:"kind"`
	Path        string        `json:"path"`
	Payload     PresetPayload `json:"payload"`
}

Preset represents a transcoding preset

type PresetList

type PresetList []Preset

PresetList represents the response returned by a query for the list of jobs

type PresetPayload

type PresetPayload struct {
	Targets []PresetTarget `json:"targets"`
}

type PresetTarget

type PresetTarget struct {
	FilePattern string `json:"file_pattern"`
	Container   struct {
		Kind string `json:"kind"`
	} `json:"container"`
	Video         VideoTarget   `json:"video,omitempty"`
	Audio         []AudioTarget `json:"audio,omitempty"`
	ExistingFiles string        `json:"existing_files,omitempty"`
	UID           string        `json:"uid,omitempty"`
}

type ToError

type ToError struct {
	Element string `json:"element,omitempty"`
}

ToError .

type ToSuccess

type ToSuccess struct {
	Element string `json:"element,omitempty"`
}

ToSuccess .

type TranscodeContainer

type TranscodeContainer struct {
	Kind string `json:"kind"`
}

TranscodeContainer .

type TranscodeLocation

type TranscodeLocation struct {
	StorageProvider string `json:"storage_provider,omitempty"`
	Path            string `json:"path,omitempty"`
}

TranscodeLocation .

type TranscodeLocationTarget

type TranscodeLocationTarget struct {
	FilePattern   string                   `json:"file_pattern"`
	ExistingFiles string                   `json:"existing_files,omitempty"`
	Container     TranscodeTargetContainer `json:"container,omitempty"`
	Location      *TranscodeLocation       `json:"location,omitempty"`
}

TranscodeLocationTarget .

type TranscodePreset

type TranscodePreset struct {
	Key string `json:"key"`
}

TranscodePreset .

type TranscodeTarget

type TranscodeTarget struct {
	FilePattern   string                   `json:"file_pattern"`
	ExistingFiles string                   `json:"existing_files"`
	Container     TranscodeContainer       `json:"container"`
	Video         map[string]interface{}   `json:"video"`
	Audio         []map[string]interface{} `json:"audio"`
}

TranscodeTarget .

type TranscodeTargetContainer

type TranscodeTargetContainer struct {
	SegmentDuration uint `json:"segment_duration,omitempty"`
}

TranscodeTargetContainer .

type VideoTarget

type VideoTarget struct {
	Width           *int   `json:"width,omitempty"`
	Height          *int   `json:"height,omitempty"`
	BitrateMode     string `json:"bitrate_mode,omitempty"`
	BitrateKb       int    `json:"bitrate_kb,omitempty"`
	MaxBitrateKb    int    `json:"max_bitrate_kb,omitempty"`
	VbvBufferSizeKb int    `json:"vbv_buffer_size_kb,omitempty"`
	FrameRate       int    `json:"frame_rate,omitempty"`
	Codec           string `json:"codec,omitempty"`
	Profile         string `json:"profile,omitempty"`
	Level           string `json:"level,omitempty"`
	MinGOPFrames    int    `json:"min_gop_frames,omitempty"`
	MaxGOPFrames    int    `json:"max_gop_frames,omitempty"`
	UseClosedGOP    bool   `json:"use_closed_gop,omitempty"`
	InterlaceMode   string `json:"interlace_mode,omitempty"`
}

Jump to

Keyboard shortcuts

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