wserest

package module
v0.0.0-...-d7e447d Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: MIT Imports: 18 Imported by: 0

README

Go REST Library for Wowza Streaming Engine

Wowza Streaming Engine media server software includes a REST API that you can wrap with a Go library to configure, manage, and monitor your streaming media server through Go requests.

Prerequisites

Wowza Streaming Engine™ 4.0.0 or later is required.

Install

Go get it:

$ go get github.com/openfresh/wse-rest-library-go

Then import it:

import wserest "github.com/openfresh/wse-rest-library-go"

Example

// It is simple to create a setup object for transporting our settings
setup := helper.NewDefaultSettings()
setup.SetHost("http://111.111.123.123:8087/v2")
setup.SetUseDigest(true)
setup.SetUsername("my_secret_username")
setup.SetPassword("my_super_cool_password")

// Connect to the server or deal with statistics
server := wserest.NewServer(setup)
sf := wserest.NewStatistics(setup)

response, err := sf.GetServerStatistics(server)
if err != nil {
	log.Fatal(err)
}

License

See LICENSE.

Copyright © CyberAgent, Inc. All Rights Reserved.

Documentation

Overview

Example
package main

import (
	"fmt"
	"log"
	"os"

	wserest "github.com/openfresh/wse-rest-library-go"
	"github.com/openfresh/wse-rest-library-go/entity/application/helper"
)

var UseWowza = getenv("USE_WOWZA", "")
var WowzaHost = getenv("WOWZA_HOST", "http://111.111.123.123:8087/v2")
var WowzaServerInstance = getenv("WOWZA_SERVER_INSTANCE", "_defaultServer_")
var WowzaVhostInstance = getenv("WOWZA_VHOST_INSTANCE", "_defaultVHost_")

var WowzaUsername = getenv("WOWZA_USERNAME", "my_secret_username")
var WowzaPassword = getenv("WOWZA_PASSWORD", "my_super_cool_password")

func getenv(key, fallback string) string {
	value := os.Getenv(key)
	if len(value) == 0 {
		return fallback
	}
	return value
}

func main() {
	// It is simple to create a setup object for transporting our settings
	setup := helper.NewDefaultSettings()
	setup.SetHost(WowzaHost)
	setup.SetUseDigest(true)
	setup.SetUsername(WowzaUsername)
	setup.SetPassword(WowzaPassword)

	// Connect to the server or deal with statistics NOTICE THE CAPS IN COM AND WOWZA
	server := wserest.NewServer(setup)
	sf := wserest.NewStatistics(setup)

	if UseWowza == "" {
		fmt.Println(2)
		return
	}

	response, err := sf.GetServerStatistics(server)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(len(response))
}
Output:

2

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

Application Operations

func NewApplication

func NewApplication(
	settings *helper.Settings,
	name string,
	appType string,
	readAccess string,
	writeAccess string,
	description string) *Application

NewApplication create Application object

func (*Application) AddAdditionalParameter

func (w *Application) AddAdditionalParameter(key string, value interface{})

func (*Application) AddSkipParameter

func (w *Application) AddSkipParameter(key string)

func (*Application) Create

func (a *Application) Create(
	streamConfig *application.StreamConfig,
	securityConfig *application.SecurityConfig,
	modules *application.Modules,
	dvrConfig *application.DvrConfig,
	transConfig *application.TranscoderConfig,
	drmConfig *application.DrmConfig,
) (map[string]interface{}, error)

Create adds the specified Application configuration

func (*Application) Get

func (a *Application) Get() (map[string]interface{}, error)

Get retrieves the specified Application configuration

func (*Application) GetAdvanced

func (a *Application) GetAdvanced() (map[string]interface{}, error)

GetAdvanced retrieves the specified advanced Application configuration

func (*Application) GetAll

func (a *Application) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of Applications

func (*Application) Name

func (a *Application) Name() string

Name return name property

func (*Application) Remove

func (a *Application) Remove() (map[string]interface{}, error)

Remove deletes the specified Application configuration

func (*Application) Update

func (a *Application) Update(
	streamConfig *application.StreamConfig,
	securityConfig *application.SecurityConfig,
	modules *application.Modules,
	dvrConfig *application.DvrConfig,
	transConfig *application.TranscoderConfig,
	drmConfig *application.DrmConfig,
) (map[string]interface{}, error)

Update updates the specified Application configuration

func (*Application) UpdateAdvanced

func (a *Application) UpdateAdvanced(advancedSettings *application.AdvancedSettings, modules *application.Modules) (map[string]interface{}, error)

UpdateAdvanced updates the specified advanced Application configuration

type DvrClipExtraction

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

DvrClipExtraction is DVR stores utility

func NewDvrClipExtraction

func NewDvrClipExtraction(settings *helper.Settings, appName string, appInstance string) *DvrClipExtraction

NewDvrClipExtraction creates DvrClipExtraction object

func (*DvrClipExtraction) AddAdditionalParameter

func (w *DvrClipExtraction) AddAdditionalParameter(key string, value interface{})

func (*DvrClipExtraction) AddSkipParameter

func (w *DvrClipExtraction) AddSkipParameter(key string)

func (*DvrClipExtraction) ClearCache

func (d *DvrClipExtraction) ClearCache() (map[string]interface{}, error)

ClearCache clear cache

func (*DvrClipExtraction) Convert

func (d *DvrClipExtraction) Convert(name string, startTime *time.Time, endTime *time.Time, outputFileName string) (map[string]interface{}, error)

Convert converts

  • /// query params
  • dvrConverterStartTime=[unix timestamp]
  • dvrConverterEndTime=[unix-timestamp]
  • dvrConverterOutputFilename=[outputfilename] *
  • @param $startTime is a unix timestamp
  • @param $endTime is a unix timestamp
  • @param $outputFileName is a string

func (*DvrClipExtraction) ConvertByDurationWithEndTime

func (d *DvrClipExtraction) ConvertByDurationWithEndTime(name string, endTime *time.Time, duration *time.Duration, outputFileName string) (map[string]interface{}, error)

ConvertByDurationWithEndTime convert by duration with end time

func (*DvrClipExtraction) ConvertByDurationWithStartTime

func (d *DvrClipExtraction) ConvertByDurationWithStartTime(name string, startTime *time.Time, duration *time.Duration, outputFileName string) (map[string]interface{}, error)

ConvertByDurationWithStartTime conver by duration with start time

func (*DvrClipExtraction) ConvertGroup

func (d *DvrClipExtraction) ConvertGroup(nameArr []string) (map[string]interface{}, error)

ConvertGroup convert group

func (*DvrClipExtraction) Create

func (d *DvrClipExtraction) Create() (map[string]interface{}, error)

Create creates a new DVR store

func (*DvrClipExtraction) DebugConversions

func (d *DvrClipExtraction) DebugConversions(name string) (map[string]interface{}, error)

DebugConversions converts

func (*DvrClipExtraction) GetAll

func (d *DvrClipExtraction) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of DVR stores associated with this application instance

func (*DvrClipExtraction) GetItem

func (d *DvrClipExtraction) GetItem(name string) (map[string]interface{}, error)

GetItem retrieves the information about a store/converter

func (*DvrClipExtraction) Remove

func (d *DvrClipExtraction) Remove(fileName string) (map[string]interface{}, error)

Remove delete DVR store

type Logging

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

Logging is log file utility

func NewLogging

func NewLogging(settings *helper.Settings) *Logging

NewLogging creates Logging object

func (*Logging) AddAdditionalParameter

func (w *Logging) AddAdditionalParameter(key string, value interface{})

func (*Logging) AddSkipParameter

func (w *Logging) AddSkipParameter(key string)

func (*Logging) GetLineCount

func (l *Logging) GetLineCount(num int) (map[string]interface{}, error)

GetLineCount retrieves the contents of a Server Log

func (*Logging) GetNewestFirst

func (l *Logging) GetNewestFirst() (map[string]interface{}, error)

GetNewestFirst retrieves the list of server log files

func (*Logging) Search

func (l *Logging) Search(str string) (map[string]interface{}, error)

Search retrieves the contents of a Server Log containing str

type Publisher

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

Publisher is publisher utility

func NewPublisher

func NewPublisher(settings *helper.Settings, publisherName string) *Publisher

NewPublisher creates Publisher object

func (*Publisher) AddAdditionalParameter

func (w *Publisher) AddAdditionalParameter(key string, value interface{})

func (*Publisher) AddSkipParameter

func (w *Publisher) AddSkipParameter(key string)

func (*Publisher) Create

func (p *Publisher) Create(password string) (map[string]interface{}, error)

Create adds a new Publisher to the list

func (*Publisher) GetAll

func (p *Publisher) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of server Publishers

func (*Publisher) Remove

func (p *Publisher) Remove() (map[string]interface{}, error)

Remove deletes the specified Publisher configuration

type Recording

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

Recording is Stream Recorder utility

func NewRecording

func NewRecording(settings *helper.Settings, appName string, appInstance string) *Recording

NewRecording creates Recording object

func (*Recording) AddAdditionalParameter

func (w *Recording) AddAdditionalParameter(key string, value interface{})

func (*Recording) AddSkipParameter

func (w *Recording) AddSkipParameter(key string)

func (*Recording) Create

func (r *Recording) Create(
	recorderName string,
	instanceName string,
	recorderState string,
	defaultRecorder bool,
	segmentationType string,
	outputPath string,
	baseFile string,
	fileFormat string,
	fileVersionDelegateName string,
	fileTemplate string,
	segmentDuration int,
	segmentSize int,
	segmentSchedule string,
	recordData bool,
	startOnKeyFrame bool,
	splitOnTcDiscontinuity bool,
	option string,
	moveFirstVideoFrameToZero bool,
	currentSize int,
	currentDuration int,
	recordingStartTime string,
) (map[string]interface{}, error)

Create creates a new Stream Recorder in the specified Application Instance and starts recording

func (*Recording) GetAll

func (r *Recording) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of Stream Recorders

func (*Recording) GetDefaultParams

func (r *Recording) GetDefaultParams(recorderName string) (map[string]interface{}, error)

GetDefaultParams retrieves a Stream Recorder of the requested name, popluated with the default values

func (*Recording) GetRecorder

func (r *Recording) GetRecorder(recorderName string) (map[string]interface{}, error)

GetRecorder retrieves the specifed Stream Recorder

func (*Recording) Split

func (r *Recording) Split(recorderName string) (map[string]interface{}, error)

Split splits recording

func (*Recording) Stop

func (r *Recording) Stop(recorderName string) (map[string]interface{}, error)

Stop stop recording

type Server

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

Server is server utility

func NewServer

func NewServer(settings *helper.Settings) *Server

NewServer creates Server object

func (*Server) AddAdditionalParameter

func (w *Server) AddAdditionalParameter(key string, value interface{})

func (*Server) AddSkipParameter

func (w *Server) AddSkipParameter(key string)

func (*Server) CreateUser

func (s *Server) CreateUser(name string, password string, groups []string) (map[string]interface{}, error)

CreateUser adds a new server User to the list

func (*Server) GetUsers

func (s *Server) GetUsers() (map[string]interface{}, error)

GetUsers retrieves the list of server Users

func (*Server) RemoveUser

func (s *Server) RemoveUser(name string) (map[string]interface{}, error)

RemoveUser deletes the specified User configuration

type SmilFile

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

SmilFile is SMIL Files utitility

func NewSmilFile

func NewSmilFile(settings *helper.Settings, appName string) *SmilFile

NewSmilFile create SmilFile

func (*SmilFile) AddAdditionalParameter

func (w *SmilFile) AddAdditionalParameter(key string, value interface{})

func (*SmilFile) AddSkipParameter

func (w *SmilFile) AddSkipParameter(key string)

func (*SmilFile) Create

func (s *SmilFile) Create(fileName string, streams []map[string]interface{}) (map[string]interface{}, error)

Create adds the specified SMIL File configuration

func (*SmilFile) Get

func (s *SmilFile) Get(fileName string) (map[string]interface{}, error)

Get retrieves the specified SMIL File configuration

func (*SmilFile) GetAll

func (s *SmilFile) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of SMIL Files for the specified Application

func (*SmilFile) Remove

func (s *SmilFile) Remove(fileName string) (map[string]interface{}, error)

Remove deletes the specified SMIL File configuration

type Statistics

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

Statistics is statistics utility

func NewStatistics

func NewStatistics(
	settings *helper.Settings) *Statistics

NewStatistics create Statistics object

func (*Statistics) AddAdditionalParameter

func (w *Statistics) AddAdditionalParameter(key string, value interface{})

func (*Statistics) AddSkipParameter

func (w *Statistics) AddSkipParameter(key string)

func (*Statistics) GetApplicationStatistics

func (s *Statistics) GetApplicationStatistics(application *Application) (map[string]interface{}, error)

GetApplicationStatistics retrieves the current Application statistics

func (*Statistics) GetApplicationStatisticsHistory

func (s *Statistics) GetApplicationStatisticsHistory(application *Application) (map[string]interface{}, error)

GetApplicationStatisticsHistory retrieves the historic Application statistics

func (*Statistics) GetIncomingApplicationStatistics

func (s *Statistics) GetIncomingApplicationStatistics(application *Application, streamName string, appInstance string) (map[string]interface{}, error)

GetIncomingApplicationStatistics retrieves the Current Incoming Stream statistics for the specifed Incoming Stream

func (*Statistics) GetServerStatistics

func (s *Statistics) GetServerStatistics(server *Server) (map[string]interface{}, error)

GetServerStatistics retrieves the server historical statictics

func (*Statistics) GetServerStatisticsCurrent

func (s *Statistics) GetServerStatisticsCurrent(server *Server) (map[string]interface{}, error)

GetServerStatisticsCurrent retrieves current statictics for the machine

type StreamFile

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

StreamFile is Stream File utility

func NewStreamFile

func NewStreamFile(settings *helper.Settings, appName, streamFileName string) *StreamFile

NewStreamFile create StreamFile

func (*StreamFile) AddAdditionalParameter

func (w *StreamFile) AddAdditionalParameter(key string, value interface{})

func (*StreamFile) AddSkipParameter

func (w *StreamFile) AddSkipParameter(key string)

func (*StreamFile) Connect

func (s *StreamFile) Connect(subFolder string) (map[string]interface{}, error)

Connect connects

func (*StreamFile) Create

func (s *StreamFile) Create(urlProps map[string]interface{}, mediaCasterType string, applicationInstance string) (map[string]interface{}, error)

Create adds the specified Stream File configuration

func (*StreamFile) Disconnect

func (s *StreamFile) Disconnect() (map[string]interface{}, error)

Disconnect disconnect

func (*StreamFile) Get

func (s *StreamFile) Get() (map[string]interface{}, error)

Get retrieves the specified Stream File configuration

func (*StreamFile) GetAll

func (s *StreamFile) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of Stream Files for the specified VHost

func (*StreamFile) Remove

func (s *StreamFile) Remove() (map[string]interface{}, error)

Remove deletes the specified Stream File configuration

func (*StreamFile) Reset

func (s *StreamFile) Reset() (map[string]interface{}, error)

Reset stream

func (*StreamFile) Update

func (s *StreamFile) Update(urlProps map[string]interface{}) (map[string]interface{}, error)

Update updates the Advanced Stream File configuration

type StreamTarget

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

StreamTarget is PushPublish map entries utility

func NewStreamTarget

func NewStreamTarget(settings *helper.Settings, appName string) *StreamTarget

NewStreamTarget create StreamTarget object

func (*StreamTarget) AddAdditionalParameter

func (w *StreamTarget) AddAdditionalParameter(key string, value interface{})

func (*StreamTarget) AddSkipParameter

func (w *StreamTarget) AddSkipParameter(key string)

func (*StreamTarget) Create

func (s *StreamTarget) Create(
	sourceStreamName,
	entryName,
	profile,
	host,
	userName,
	password,
	streamName,
	application string) (map[string]interface{}, error)

Create adds the specified PushPublish map entry for the specified Application

func (*StreamTarget) GetAll

func (s *StreamTarget) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of PushPublish map entries for the specified Application

func (*StreamTarget) Remove

func (s *StreamTarget) Remove(entryName string) (map[string]interface{}, error)

Remove deletes the specified PushPublish map entry for the specified Application

type User

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

User is Server Users utiliyt

func NewUser

func NewUser(settings *helper.Settings, userName string) *User

NewUser create User object

func (*User) AddAdditionalParameter

func (w *User) AddAdditionalParameter(key string, value interface{})

func (*User) AddSkipParameter

func (w *User) AddSkipParameter(key string)

func (*User) Create

func (u *User) Create(password string, group []string) (map[string]interface{}, error)

Create adds a new server User to the list

func (*User) GetAll

func (u *User) GetAll() (map[string]interface{}, error)

GetAll retrieves the list of server Users

func (*User) Remove

func (u *User) Remove() (map[string]interface{}, error)

Remove deletes the specified User configuration

type VerbType

type VerbType int

VerbType is verb type

const (
	// POST is post method
	POST VerbType = iota
	// GET is get method
	GET
	// DELETE is delete method
	DELETE
	// PUT is put method
	PUT
)

func (VerbType) String

func (v VerbType) String() string

Directories

Path Synopsis
entity

Jump to

Keyboard shortcuts

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