mediapackage

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 23 Imported by: 0

README

MediaPackage

Parity grade: A · SDK aws-sdk-go-v2/service/mediapackage@v1.42.4 · last audited 2026-08-10 (f942b4d6b9d0353bd693cc733196bc7228ededd9)

Coverage

Metric Value
Operations audited 19 (19 ok)
Feature families 4 (4 ok)
Known gaps none
Deferred items 1
Resource leaks clean
Deferred
  • HlsPackage/DashPackage/CmafPackage remain an opaque map[string]any passthrough -- NOT semantically validated (no ad-marker/encryption logic for these three). Sized this pass: HlsPackage has 12 leaf fields across 3 enum types plus a nested HlsEncryption/SpekeKeyProvider chain; DashPackage has 14 leaf fields across 5 enum types plus DashEncryption/SpekeKeyProvider; CmafPackage additionally nests a list of HlsManifest sub-resources (~10 fields each) -- a materially larger, separate unit of work from Authorization/MssPackage (2 and ~11 leaf fields, single level of nesting, no repeated sub-resources), which this pass modeled to full depth instead of shaving fields to fit. Next pass: model Hls/Dash/Cmaf to the same full depth if a consumer needs it.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = awserr.New("UnprocessableEntityException", awserr.ErrAlreadyExists)

ErrConflict is returned for duplicate resource IDs.

View Source
var ErrInvalidParameter = awserr.New("UnprocessableEntityException", awserr.ErrInvalidParameter)

ErrInvalidParameter is returned for invalid input.

View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned when Provider.Init is called with a nil AppContext.

View Source
var ErrNotFound = awserr.New("NotFoundException", awserr.ErrNotFound)

ErrNotFound is returned when a resource does not exist.

Functions

This section is empty.

Types

type Authorization added in v1.3.1

type Authorization struct {
	CdnIdentifierSecret string `json:"cdnIdentifierSecret"`
	SecretsRoleArn      string `json:"secretsRoleArn"`
}

Authorization holds CDN-authorization credentials on an OriginEndpoint. Both fields are required together (types.Authorization, aws-sdk-go-v2/service/mediapackage@v1.42.4, types/types.go:10-26).

type Channel

type Channel struct {
	HlsIngest           *HlsIngest
	EgressLogGroupName  *string
	IngressLogGroupName *string
	Tags                map[string]string
	ARN                 string
	ID                  string
	Description         string
	CreatedAt           string
}

Channel represents a MediaPackage channel.

type EncryptionContractConfiguration added in v1.3.1

type EncryptionContractConfiguration struct {
	PresetSpeke20Audio string `json:"presetSpeke20Audio"`
	PresetSpeke20Video string `json:"presetSpeke20Video"`
}

EncryptionContractConfiguration selects SPEKE 2.0 audio/video encryption presets (types.EncryptionContractConfiguration, SDK types/types.go:246-259).

type Handler

type Handler struct {
	Backend StorageBackend
}

Handler handles MediaPackage HTTP requests.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation classifies the request into an operation name.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns all supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset resets the backend.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches MediaPackage requests by path and Authorization header. IoTAnalytics shares /channels paths, so we must distinguish by the service name embedded in the AWS Signature header.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type HarvestJob

type HarvestJob struct {
	S3Destination    *S3Destination
	ARN              string
	ChannelID        string
	CreatedAt        string
	EndTime          string
	ID               string
	OriginEndpointID string
	StartTime        string
	Status           string
}

HarvestJob represents a MediaPackage harvest job.

type HlsIngest

type HlsIngest struct {
	IngestEndpoints []*IngestEndpoint
}

HlsIngest holds a list of ingest endpoints for a channel.

type InMemoryBackend

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

InMemoryBackend is an in-memory implementation of StorageBackend.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new InMemoryBackend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the configured AWS account ID.

func (*InMemoryBackend) ConfigureLogs

func (b *InMemoryBackend) ConfigureLogs(id string, egressLogGroup, ingressLogGroup *string) (*Channel, error)

ConfigureLogs updates the egress/ingress log group configuration for a channel. A nil pointer means the caller did not send that egressAccessLogs/ingressAccessLogs block and leaves the existing configuration untouched, matching AWS's optional-member semantics.

func (*InMemoryBackend) CreateChannel

func (b *InMemoryBackend) CreateChannel(id, description string, tags map[string]string) (*Channel, error)

CreateChannel creates a new MediaPackage channel.

func (*InMemoryBackend) CreateHarvestJob

func (b *InMemoryBackend) CreateHarvestJob(
	id, originEndpointID, startTime, endTime string,
	s3Dest S3Destination,
) (*HarvestJob, error)

CreateHarvestJob creates a new harvest job record.

func (*InMemoryBackend) CreateOriginEndpoint

func (b *InMemoryBackend) CreateOriginEndpoint(
	channelID, id, description, manifestName string,
	startoverWindowSeconds, timeDelaySeconds int,
	origination string,
	whitelist []string,
	tags map[string]string,
	pkg PackagingConfig,
) (*OriginEndpoint, error)

CreateOriginEndpoint creates a new origin endpoint.

func (*InMemoryBackend) DeleteChannel

func (b *InMemoryBackend) DeleteChannel(id string) (*Channel, error)

DeleteChannel deletes a channel and all its origin endpoints.

func (*InMemoryBackend) DeleteOriginEndpoint

func (b *InMemoryBackend) DeleteOriginEndpoint(id string) (*OriginEndpoint, error)

DeleteOriginEndpoint deletes an origin endpoint.

func (*InMemoryBackend) DescribeChannel

func (b *InMemoryBackend) DescribeChannel(id string) (*Channel, error)

DescribeChannel returns a channel by ID.

func (*InMemoryBackend) DescribeHarvestJob

func (b *InMemoryBackend) DescribeHarvestJob(id string) (*HarvestJob, error)

DescribeHarvestJob returns a harvest job by ID.

func (*InMemoryBackend) DescribeOriginEndpoint

func (b *InMemoryBackend) DescribeOriginEndpoint(id string) (*OriginEndpoint, error)

DescribeOriginEndpoint returns an origin endpoint by ID.

func (*InMemoryBackend) ListChannels

func (b *InMemoryBackend) ListChannels(maxResults int, nextToken string) ([]*Channel, string, error)

ListChannels returns a paginated list of channels sorted by ID.

func (*InMemoryBackend) ListHarvestJobs

func (b *InMemoryBackend) ListHarvestJobs(
	includeChannelID, includeStatus string,
	maxResults int,
	nextToken string,
) ([]*HarvestJob, string, error)

ListHarvestJobs returns a paginated list of harvest jobs, optionally filtered by channel or status.

func (*InMemoryBackend) ListOriginEndpoints

func (b *InMemoryBackend) ListOriginEndpoints(
	channelID string,
	maxResults int,
	nextToken string,
) ([]*OriginEndpoint, string, error)

ListOriginEndpoints returns a paginated list of origin endpoints.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)

ListTagsForResource returns all tags for a resource.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the configured AWS region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored data.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) RotateChannelCredentials

func (b *InMemoryBackend) RotateChannelCredentials(id string) (*Channel, error)

RotateChannelCredentials changes the channel's first IngestEndpoint's username and password (this legacy API only ever touches ingestEndpoints[0] -- callers wanting to rotate a specific endpoint use RotateIngestEndpointCredentials instead). The endpoint's ID and URL are left unchanged; only the credentials are regenerated.

func (*InMemoryBackend) RotateIngestEndpointCredentials

func (b *InMemoryBackend) RotateIngestEndpointCredentials(channelID, ingestEndpointID string) (*Channel, error)

RotateIngestEndpointCredentials rotates credentials for a specific ingest endpoint.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot returns a JSON-encoded snapshot of the backend state.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error

TagResource adds or updates tags on a resource.

func (*InMemoryBackend) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every MediaPackage resource ARN (channels and origin endpoints) that currently has at least one tag applied via TagResource.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, keys []string) error

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateChannel

func (b *InMemoryBackend) UpdateChannel(id, description string) (*Channel, error)

UpdateChannel updates a channel's description.

func (*InMemoryBackend) UpdateOriginEndpoint

func (b *InMemoryBackend) UpdateOriginEndpoint(
	id, description, manifestName string,
	startoverWindowSeconds, timeDelaySeconds int,
	origination string,
	whitelist []string,
	pkg PackagingConfig,
) (*OriginEndpoint, error)

UpdateOriginEndpoint updates an origin endpoint's configuration.

type IngestEndpoint

type IngestEndpoint struct {
	ID       string
	URL      string
	Username string
	Password string
}

IngestEndpoint holds ingest URL and credentials for a channel.

type MssEncryption added in v1.3.1

type MssEncryption struct {
	SpekeKeyProvider *SpekeKeyProvider `json:"spekeKeyProvider,omitempty"`
}

MssEncryption is the Microsoft Smooth Streaming encryption configuration (types.MssEncryption, SDK types/types.go:563-572).

type MssPackage added in v1.3.1

type MssPackage struct {
	Encryption             *MssEncryption   `json:"encryption,omitempty"`
	StreamSelection        *StreamSelection `json:"streamSelection,omitempty"`
	ManifestWindowSeconds  int              `json:"manifestWindowSeconds,omitempty"`
	SegmentDurationSeconds int              `json:"segmentDurationSeconds,omitempty"`
}

MssPackage is a Microsoft Smooth Streaming packaging configuration (types.MssPackage, SDK types/types.go:575-590).

type OriginEndpoint

type OriginEndpoint struct {
	Authorization          *Authorization
	MssPackage             *MssPackage
	CmafPackage            map[string]any
	DashPackage            map[string]any
	HlsPackage             map[string]any
	Tags                   map[string]string
	ARN                    string
	ChannelID              string
	ID                     string
	Description            string
	ManifestName           string
	URL                    string
	Origination            string
	CreatedAt              string
	Whitelist              []string
	StartoverWindowSeconds int
	TimeDelaySeconds       int
}

OriginEndpoint represents a MediaPackage origin endpoint.

type PackagingConfig

type PackagingConfig struct {
	Authorization *Authorization
	CmafPackage   map[string]any
	DashPackage   map[string]any
	HlsPackage    map[string]any
	MssPackage    *MssPackage
}

PackagingConfig holds the CDN-authorization credentials and per-protocol packaging blocks (HlsPackage/DashPackage/CmafPackage/MssPackage) accepted by CreateOriginEndpoint/UpdateOriginEndpoint. Authorization and MssPackage are modeled to their full real SDK shape (small enough: 2 and ~11 leaf fields respectively, no repeated sub-resources). HlsPackage/DashPackage/ CmafPackage remain an opaque passthrough -- each carries 12-16 leaf fields across several enum types, and CmafPackage additionally nests a *list* of HlsManifest sub-resources (~10 fields each); modeling those to the same full depth is a materially larger, separate unit of work (see PARITY.md). Every block is stored verbatim as the caller supplied it -- Describe/List echo back exactly what was configured.

type Provider

type Provider struct{}

Provider implements service.Provider for the MediaPackage service.

func (*Provider) Init

Init initializes the MediaPackage backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type S3Destination

type S3Destination struct {
	BucketName  string
	ManifestKey string
	RoleArn     string
}

S3Destination describes where harvested content is exported.

type SpekeKeyProvider added in v1.3.1

type SpekeKeyProvider struct {
	EncryptionContractConfiguration *EncryptionContractConfiguration `json:"encryptionContractConfiguration,omitempty"`
	ResourceID                      string                           `json:"resourceId"`
	RoleArn                         string                           `json:"roleArn"`
	URL                             string                           `json:"url"`
	CertificateArn                  string                           `json:"certificateArn,omitempty"`
	SystemIDs                       []string                         `json:"systemIds"`
}

SpekeKeyProvider configures an external SPEKE key provider. ResourceID, RoleArn, SystemIDs, and URL are required together (types.SpekeKeyProvider, SDK types/types.go:681-721).

type StorageBackend

type StorageBackend interface {
	CreateChannel(id, description string, tags map[string]string) (*Channel, error)
	DescribeChannel(id string) (*Channel, error)
	UpdateChannel(id, description string) (*Channel, error)
	DeleteChannel(id string) (*Channel, error)
	ListChannels(maxResults int, nextToken string) ([]*Channel, string, error)
	ConfigureLogs(id string, egressLogGroup, ingressLogGroup *string) (*Channel, error)
	RotateChannelCredentials(id string) (*Channel, error)
	RotateIngestEndpointCredentials(channelID, ingestEndpointID string) (*Channel, error)

	CreateOriginEndpoint(
		channelID, id, description, manifestName string,
		startoverWindowSeconds, timeDelaySeconds int,
		origination string,
		whitelist []string,
		tags map[string]string,
		pkg PackagingConfig,
	) (*OriginEndpoint, error)
	DescribeOriginEndpoint(id string) (*OriginEndpoint, error)
	UpdateOriginEndpoint(
		id, description, manifestName string,
		startoverWindowSeconds, timeDelaySeconds int,
		origination string,
		whitelist []string,
		pkg PackagingConfig,
	) (*OriginEndpoint, error)
	DeleteOriginEndpoint(id string) (*OriginEndpoint, error)
	ListOriginEndpoints(channelID string, maxResults int, nextToken string) ([]*OriginEndpoint, string, error)

	CreateHarvestJob(id, originEndpointID, startTime, endTime string, s3Dest S3Destination) (*HarvestJob, error)
	DescribeHarvestJob(id string) (*HarvestJob, error)
	ListHarvestJobs(
		includeChannelID, includeStatus string,
		maxResults int,
		nextToken string,
	) ([]*HarvestJob, string, error)

	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, keys []string) error
	ListTagsForResource(resourceARN string) (map[string]string, error)

	AccountID() string
	Region() string
	Reset()
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for MediaPackage storage operations.

type StreamSelection added in v1.3.1

type StreamSelection struct {
	StreamOrder           string `json:"streamOrder,omitempty"`
	MaxVideoBitsPerSecond int    `json:"maxVideoBitsPerSecond,omitempty"`
	MinVideoBitsPerSecond int    `json:"minVideoBitsPerSecond,omitempty"`
}

StreamSelection filters/orders streams in packaged output (types.StreamSelection, SDK types/types.go:724-736).

type TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tags.

Jump to

Keyboard shortcuts

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