elementalconductor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package elementalconductor provides types and methods for interacting with the Elemental Conductor API.

You can get more details on the API at https://<elemental_server>/help/rest_api.

Index

Constants

View Source
const (
	// FileOutputGroupType is the value for the type field on OutputGroup
	// for jobs with a file output
	FileOutputGroupType = OutputGroupType("file_group_settings")
	// AppleLiveOutputGroupType is the value for the type field on OutputGroup
	// for jobs with Apple's HTTP Live Streaming (HLS) output
	AppleLiveOutputGroupType = OutputGroupType("apple_live_group_settings")
)
View Source
const (
	// AppleHTTPLiveStreaming is the container for HLS video files
	AppleHTTPLiveStreaming = Container("m3u8")
	// MPEG4 is the container for MPEG-4 video files
	MPEG4 = Container("mp4")
)
View Source
const (
	// ProductConductorFile is condutor file product.
	ProductConductorFile = NodeProduct("Conductor File")

	// ProductServer is the server product.
	ProductServer = NodeProduct("Server")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status int    `json:"status,omitempty"`
	Errors string `json:"errors,omitempty"`
}

APIError represents an error returned by the Elemental Cloud REST API.

See https://<elemental_server>/help/rest_api#rest_basics_errors_and_warnings for more details.

func (*APIError) Error

func (apiErr *APIError) Error() string

Error converts the whole interlying information to a representative string.

It encodes the list of errors in JSON format.

type AppleLiveGroupSettings

type AppleLiveGroupSettings struct {
	Destination     *Location `xml:"destination,omitempty"`
	SegmentDuration uint      `xml:"segment_length,omitempty"`
	EmitSingleFile  bool      `xml:"emit_single_file,omitempty"`
}

AppleLiveGroupSettings define where the HLS job output should go

type Client

type Client struct {
	Host            string
	UserLogin       string
	APIKey          string
	AuthExpires     int
	AccessKeyID     string
	SecretAccessKey string
	Destination     string
}

Client is the basic type for interacting with the API. It provides methods matching the available actions in the API.

func NewClient

func NewClient(host, userLogin, apiKey string, authExpires int, accessKeyID string, secretAccessKey string, destination string) *Client

NewClient creates a instance of the client type.

func (*Client) CancelJob

func (c *Client) CancelJob(jobID string) (*Job, error)

CancelJob cancels the given job in the Elemental Conductor API.

func (*Client) CreateJob

func (c *Client) CreateJob(job *Job) (*Job, error)

CreateJob sends a single job to the current Elemental Cloud deployment for processing

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

func (c *Client) GetCloudConfig() (*CloudConfig, error)

GetCloudConfig returns the current Elemental Cloud configuration. It includes Autoscaler Settings.

func (*Client) GetJob

func (c *Client) GetJob(jobID string) (*Job, error)

GetJob returns metadata on a single job

func (*Client) GetJobs

func (c *Client) GetJobs() (*JobList, error)

GetJobs returns a list of the user's jobs

func (*Client) GetNodes

func (c *Client) GetNodes() ([]Node, error)

GetNodes returns the list of nodes currently available in the Elemental setup.

func (*Client) GetPreset

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

GetPreset return details of a given presetID

func (*Client) GetPresets

func (c *Client) GetPresets() (*PresetList, error)

GetPresets returns a list of presets

type CloudConfig

type CloudConfig struct {
	XMLName             xml.Name `xml:"cloud_config"`
	AuthorizedNodeCount int      `xml:"authorized_node_count"`
	MaxNodes            int      `xml:"max_cluster_size"`
	MinNodes            int      `xml:"min_cluster_size"`
	WorkerVariant       string   `xml:"worker_variant"`
}

CloudConfig contains configuration for Elemental Cloud, including Autoscaler Settings.

type Container

type Container string

Container is the Video container type for a job

type ContentDuration

type ContentDuration struct {
	InputDuration int `xml:"input_duration"`
}

ContentDuration contains information about the content of the media in the job.

type DateTime

type DateTime struct {
	time.Time
}

DateTime is a custom struct for representing time within ElementalConductor. It customizes marshalling, and always store the underlying time in UTC.

func (DateTime) MarshalXML

func (jdt DateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implementation on DateTimeg to skip "zero" time values

func (*DateTime) UnmarshalXML

func (jdt *DateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implementation on DateTimeg to use dateTimeLayout

type FileGroupSettings

type FileGroupSettings struct {
	Destination *Location `xml:"destination,omitempty"`
}

FileGroupSettings define where the file job output should go

type Input

type Input struct {
	FileInput Location   `xml:"file_input,omitempty"`
	InputInfo *InputInfo `xml:"input_info,omitempty"`
}

Input represents the spec for the job's input

type InputInfo

type InputInfo struct {
	Video VideoInputInfo `xml:"video"`
}

InputInfo contains metadata related to a job input.

type Job

type Job struct {
	XMLName         xml.Name         `xml:"job"`
	Href            string           `xml:"href,attr,omitempty"`
	Input           Input            `xml:"input,omitempty"`
	ContentDuration *ContentDuration `xml:"content_duration,omitempty"`
	Priority        int              `xml:"priority,omitempty"`
	OutputGroup     []OutputGroup    `xml:"output_group,omitempty"`
	StreamAssembly  []StreamAssembly `xml:"stream_assembly,omitempty"`
	Status          string           `xml:"status,omitempty"`
	Submitted       DateTime         `xml:"submitted,omitempty"`
	StartTime       DateTime         `xml:"start_time,omitempty"`
	CompleteTime    DateTime         `xml:"complete_time,omitempty"`
	ErroredTime     DateTime         `xml:"errored_time,omitempty"`
	PercentComplete int              `xml:"pct_complete,omitempty"`
	ErrorMessages   []JobError       `xml:"error_messages,omitempty"`
}

Job represents a job to be sent to Elemental Cloud

func (*Job) GetID

func (j *Job) GetID() string

GetID is a convenience function to parse the job id out of the Href attribute in Job

type JobError

type JobError struct {
	Code      int              `xml:"error>code,omitempty"`
	CreatedAt JobErrorDateTime `xml:"error>created_at,omitempty"`
	Message   string           `xml:"error>message,omitempty"`
}

JobError represents an individual error on a job

type JobErrorDateTime

type JobErrorDateTime struct {
	time.Time
}

JobErrorDateTime is a custom time struct to be used on Media items

func (JobErrorDateTime) MarshalXML

func (jdt JobErrorDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implementation on JobErrorDateTime to skip "zero" time values

func (*JobErrorDateTime) UnmarshalXML

func (jdt *JobErrorDateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implementation on JobErrorDateTime to use errorDateTimeLayout

type JobList

type JobList struct {
	XMLName xml.Name `xml:"job_list"`
	Empty   string   `xml:"empty,omitempty"`
	Job     []Job    `xml:"job"`
}

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

type Location

type Location struct {
	URI      string `xml:"uri,omitempty"`
	Username string `xml:"username,omitempty"`
	Password string `xml:"password,omitempty"`
}

Location defines where a file is or needs to be. Username and Password are required for certain protocols that require authentication, like S3

type Node

type Node struct {
	Href            string      `xml:"href,attr"`
	Name            string      `xml:"name"`
	HostName        string      `xml:"hostname"`
	IPAddress       string      `xml:"ip_addr"`
	PublicIPAddress string      `xml:"public_ip_addr,omitempty"`
	Eth0Mac         string      `xml:"eth0_mac"`
	Status          string      `xml:"status"`
	Product         NodeProduct `xml:"product"`
	Version         string      `xml:"version"`
	Platform        string      `xml:"platform"`
	Packages        []string    `xml:"packages>package"`
	Licenses        []string    `xml:"licenses>license"`
	CreatedAt       DateTime    `xml:"created_at"`
	RunningCount    int         `xml:"running_count,omitempty"`
}

Node is a server running one of Elemental products in one of its platforms.

type NodeProduct

type NodeProduct string

NodeProduct is the product that is running inside a node.

type Output

type Output struct {
	FullURI            string    `xml:"full_uri,omitempty"`
	StreamAssemblyName string    `xml:"stream_assembly_name,omitempty"`
	NameModifier       string    `xml:"name_modifier,omitempty"`
	Order              int       `xml:"order,omitempty"`
	Extension          string    `xml:"extension,omitempty"`
	Container          Container `xml:"container,omitempty"`
}

Output defines the different processing stream assemblies for the job

type OutputGroup

type OutputGroup struct {
	Order                  int                     `xml:"order,omitempty"`
	FileGroupSettings      *FileGroupSettings      `xml:"file_group_settings,omitempty"`
	AppleLiveGroupSettings *AppleLiveGroupSettings `xml:"apple_live_group_settings,omitempty"`
	Type                   OutputGroupType         `xml:"type,omitempty"`
	Output                 []Output                `xml:"output,omitempty"`
}

OutputGroup is a list of the indended outputs for the job

type OutputGroupType

type OutputGroupType string

OutputGroupType is a custom type for OutputGroup type field values

type Preset

type Preset struct {
	XMLName       xml.Name `xml:"preset"`
	Name          string   `xml:"name"`
	Href          string   `xml:"href,attr,omitempty"`
	Permalink     string   `xml:"permalink,omitempty"`
	Description   string   `xml:"description,omitempty"`
	Container     string   `xml:"container,omitempty"`
	Width         string   `xml:"video_description>width,omitempty"`
	Height        string   `xml:"video_description>height,omitempty"`
	VideoCodec    string   `xml:"video_description>codec,omitempty"`
	VideoBitrate  string   `xml:"video_description>h264_settings>bitrate,omitempty"`
	GopSize       string   `xml:"video_description>h264_settings>gop_size,omitempty"`
	GopMode       string   `xml:"video_description>h264_settings>gop_mode,omitempty"`
	Profile       string   `xml:"video_description>h264_settings>profile,omitempty"`
	ProfileLevel  string   `xml:"video_description>h264_settings>level,omitempty"`
	RateControl   string   `xml:"video_description>h264_settings>rate_control_mode,omitempty"`
	InterlaceMode string   `xml:"video_description>h264_settings>interlace_mode,omitempty"`
	AudioCodec    string   `xml:"audio_description>codec,omitempty"`
	AudioBitrate  string   `xml:"audio_description>aac_settings>bitrate,omitempty"`
}

Preset represents a preset

type PresetList

type PresetList struct {
	Presets []Preset `xml:"preset"`
}

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

type StreamAssembly

type StreamAssembly struct {
	ID               string                  `xml:"id,omitempty"`
	Name             string                  `xml:"name,omitempty"`
	Preset           string                  `xml:"preset,omitempty"`
	VideoDescription *StreamVideoDescription `xml:"video_description"`
}

StreamAssembly defines how each processing stream should behave

type StreamVideoDescription

type StreamVideoDescription struct {
	Codec       string `xml:"codec"`
	EncoderType string `xml:"encoder_type"`
	Height      string `xml:"height"`
	Width       string `xml:"width"`
}

StreamVideoDescription contains information about the video in a given stream assembly.

func (*StreamVideoDescription) GetHeight

func (s *StreamVideoDescription) GetHeight() int64

GetHeight returns the underlying height parsed as an int64.

func (*StreamVideoDescription) GetWidth

func (s *StreamVideoDescription) GetWidth() int64

GetWidth returns the underlying width parsed as an int64.

type VideoInputInfo

type VideoInputInfo struct {
	Format        string `xml:"format"`
	FormatInfo    string `xml:"format_info"`
	FormatProfile string `xml:"format_profile"`
	CodecID       string `xml:"codec_id"`
	CodecIDInfo   string `xml:"codec_id_info"`
	Bitrate       string `xml:"bit_rate"`
	Width         string `xml:"width"`
	Height        string `xml:"height"`
}

VideoInputInfo contains video metadata related to a job input.

func (*VideoInputInfo) GetHeight

func (v *VideoInputInfo) GetHeight() int64

GetHeight parses the underlying height returned the Elemental Conductor API and converts it to int64.

Examples:

  • Input: "1 080 pixels" Output: 1080
  • Input: "1080p" Output: 1080
  • Input: "1 080" Output: 1080

func (*VideoInputInfo) GetWidth

func (v *VideoInputInfo) GetWidth() int64

GetWidth parses the underlying width returned the Elemental Conductor API and converts it to int64.

Examples:

  • Input: "1 920 pixels" Output: 1920
  • Input: "1920p" Output: 1920
  • Input: "1 920" Output: 1920

Jump to

Keyboard shortcuts

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