admin

package
v0.0.0-...-5d1e9c5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAMResponse

func ParseAMResponse(r APIRequest, data []byte) (interface{}, error)

Types

type APIRequest

type APIRequest interface {
	ActionName() string
	Endpoint() string
	Payload() map[string]interface{}
}

type AdminAPI

type AdminAPI interface {
	AddToken(token string, plugins []string) (interface{}, error)
	AllowToken(token string, plugins []string) (interface{}, error)
	DisallowToken(token string, plugins []string) (interface{}, error)
	RemoveToken(token string) (interface{}, error)
	ListTokens() (interface{}, error)

	ListSessions() (interface{}, error)
	MessagePlugin(request plugins.PluginRequest) (interface{}, error)

	ListHandles(sessionID uint64) (interface{}, error)
	HandleInfo(sessionID, handleID uint64) (interface{}, error)

	Close() error
}

type BaseAMResponse

type BaseAMResponse struct {
	Type string `json:"janus"`
	ID   string `json:"transaction"`
}

type BaseRequest

type BaseRequest struct {
	Action      string
	Transaction string
	Secret      string
}

func (*BaseRequest) ActionName

func (r *BaseRequest) ActionName() string

func (*BaseRequest) Endpoint

func (r *BaseRequest) Endpoint() string

func (*BaseRequest) Payload

func (r *BaseRequest) Payload() map[string]interface{}

type DefaultAdminAPI

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

func NewAdminAPI

func NewAdminAPI(url, secret string) (*DefaultAdminAPI, error)

func (*DefaultAdminAPI) AddToken

func (api *DefaultAdminAPI) AddToken(token string, plugins []string) (interface{}, error)

func (*DefaultAdminAPI) AllowToken

func (api *DefaultAdminAPI) AllowToken(token string, plugins []string) (interface{}, error)

func (*DefaultAdminAPI) Close

func (api *DefaultAdminAPI) Close() error

func (*DefaultAdminAPI) DisallowToken

func (api *DefaultAdminAPI) DisallowToken(token string, plugins []string) (interface{}, error)

func (*DefaultAdminAPI) HandleInfo

func (api *DefaultAdminAPI) HandleInfo(sessionID, handleID uint64) (interface{}, error)

func (*DefaultAdminAPI) ListHandles

func (api *DefaultAdminAPI) ListHandles(sessionID uint64) (interface{}, error)

func (*DefaultAdminAPI) ListSessions

func (api *DefaultAdminAPI) ListSessions() (interface{}, error)

func (*DefaultAdminAPI) ListTokens

func (api *DefaultAdminAPI) ListTokens() (interface{}, error)

func (*DefaultAdminAPI) MessagePlugin

func (api *DefaultAdminAPI) MessagePlugin(request plugins.PluginRequest) (interface{}, error)

func (*DefaultAdminAPI) RemoveToken

func (api *DefaultAdminAPI) RemoveToken(token string) (interface{}, error)

type ErrorAMResponse

type ErrorAMResponse struct {
	BaseAMResponse
	Err janus.ErrorData `json:"error"`
}

func (*ErrorAMResponse) Error

func (err *ErrorAMResponse) Error() string

type HandleInfoResponse

type HandleInfoResponse struct {
	HandleResponse
	Info map[string]interface{} `json:"info"`
}

type HandleRequest

type HandleRequest struct {
	SessionRequest
	HandleID uint64
}

func (*HandleRequest) Endpoint

func (r *HandleRequest) Endpoint() string

func (*HandleRequest) Payload

func (r *HandleRequest) Payload() map[string]interface{}

type HandleResponse

type HandleResponse struct {
	SessionResponse
	HandleID uint64 `json:"handle_id"`
}

type HttpTransport

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

func NewHttpTransport

func NewHttpTransport(url string) *HttpTransport

func (*HttpTransport) Close

func (t *HttpTransport) Close() error

func (*HttpTransport) Request

func (t *HttpTransport) Request(r APIRequest) (interface{}, error)

type ListHandlesResponse

type ListHandlesResponse struct {
	SessionResponse
	Handles []uint64 `json:"handles"`
}

type ListSessionsResponse

type ListSessionsResponse struct {
	BaseAMResponse
	Sessions []uint64 `json:"sessions"`
}

type ListTokensResponse

type ListTokensResponse struct {
	BaseAMResponse
	Data map[string][]*StoredToken `json:"data"`
}

type MessagePluginRequest

type MessagePluginRequest struct {
	BaseRequest
	Request plugins.PluginRequest
}

func (*MessagePluginRequest) Payload

func (r *MessagePluginRequest) Payload() map[string]interface{}

type MessagePluginResponse

type MessagePluginResponse struct {
	BaseAMResponse
	Response map[string]interface{} `json:"response"`
}

type SessionRequest

type SessionRequest struct {
	BaseRequest
	SessionID uint64
}

func (*SessionRequest) Endpoint

func (r *SessionRequest) Endpoint() string

func (*SessionRequest) Payload

func (r *SessionRequest) Payload() map[string]interface{}

type SessionResponse

type SessionResponse struct {
	BaseAMResponse
	SessionID uint64 `json:"session_id"`
}

type StoredToken

type StoredToken struct {
	Token   string   `json:"token"`
	Plugins []string `json:"allowed_plugins"`
}

type SuccessAMResponse

type SuccessAMResponse struct {
	BaseAMResponse
	Data map[string]interface{} `json:"data"`
}

type TokenRequest

type TokenRequest struct {
	BaseRequest
	Token   string
	Plugins []string
}

func (*TokenRequest) Payload

func (r *TokenRequest) Payload() map[string]interface{}

type Transport

type Transport interface {
	Request(APIRequest) (interface{}, error)
	Close() error
}

type TransportError

type TransportError struct {
	Code int
	Msg  string
}

func (*TransportError) Error

func (e *TransportError) Error() string

Jump to

Keyboard shortcuts

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