mediapackage

package
v1.2.0 Latest Latest
Warning

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

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

README

MediaPackage

Parity grade: A · SDK aws-sdk-go-v2/service/mediapackage@v1.39.25 · last audited 2026-07-24 (f942b4d6b9d0353bd693cc733196bc7228ededd9)

Coverage

Metric Value
Operations audited 19 (19 ok)
Feature families 4 (4 ok)
Known gaps 1
Deferred items 1
Resource leaks clean
Known gaps
  • CreateHarvestJob always sets Status=SUCCEEDED synchronously; real MediaPackage harvest jobs start IN_PROGRESS and transition asynchronously. Low priority: most test suites just assert job existence/S3Destination, not the IN_PROGRESS state transition. Deliberately not implemented as a goroutine-driven async transition this pass -- that would trade a documented wire-shape simplification for a new leak-surface (timer/goroutine lifecycle tied to Reset/Snapshot) for a low-value behavior. (bd: TODO -- file issue if async harvest-job semantics become relevant)
Deferred
  • Packaging protocol nested config (HlsPackage/DashPackage/CmafPackage/MssPackage/Authorization) is stored and echoed back as an opaque map[string]any -- NOT semantically validated or interpreted (no SPEKE/encryption-contract logic, no ad-marker logic). This closes the 'discards config' bug (values now round-trip through Create/Update/Describe/List) but a client asserting on server-side validation of e.g. required Authorization sub-fields would not get real AWS's validation errors. Next pass: consider modeling the concrete sub-shapes if a consumer needs semantic validation.

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

type OriginEndpoint struct {
	Authorization          map[string]any
	CmafPackage            map[string]any
	DashPackage            map[string]any
	HlsPackage             map[string]any
	MssPackage             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 map[string]any
	CmafPackage   map[string]any
	DashPackage   map[string]any
	HlsPackage    map[string]any
	MssPackage    map[string]any
}

PackagingConfig holds the CDN-authorization credentials and per-protocol packaging blocks (HlsPackage/DashPackage/CmafPackage/MssPackage) accepted by CreateOriginEndpoint/UpdateOriginEndpoint. Each block is stored verbatim as the caller supplied it -- encryption/ad-marker semantics are not interpreted -- so Describe/List echo back exactly what was configured. Previously these fields were silently discarded on create/update, so a Terraform/CDK OriginEndpoint configured with e.g. hlsPackage never round-tripped through gopherstack.

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 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.

Jump to

Keyboard shortcuts

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