rekognition

package
v1.3.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: 20 Imported by: 0

README

Rekognition

Parity grade: A · SDK aws-sdk-go-v2/service/rekognition@v1.51.26 · last audited 2026-07-23 (6642a73c)

Coverage

Metric Value
Operations audited 50 (49 ok, 1 partial)
Feature families 3 (3 ok)
Known gaps 1
Deferred items 2
Resource leaks clean
Known gaps
  • CreateProjectVersion still drops TrainingData/TestingData/FeatureConfig from the request (Custom Labels training-manifest config: nested GroundTruthManifest/Asset structures with no backing resource this in-memory mock can meaningfully echo back) — low-traffic Custom Labels training flow, file a bd issue if this is needed
Deferred
  • Full field-level completeness audit of the async-video Get* response bodies (Celebrities/ModerationLabels/Faces/Labels/Persons/Segments/TextDetections arrays) — always empty; acceptable per the ML-mock exemption but not individually wire-diffed field-by-field this sweep
  • Full field-level completeness audit of ProjectVersionDescription (BaseModelVersion/BillableTrainingTimeInSeconds/EvaluationResult/Feature/ManifestSummary/MaxInferenceUnits/SourceProjectVersionArn/TestingDataResult/TrainingDataResult/TrainingEndTimestamp) beyond the OutputConfig/KmsKeyId/VersionDescription fields added this sweep — DescribeProjectVersions was already marked wire:ok by a prior audit and expanding its full field set was out of this sweep's assigned gap list (CreateProjectVersion's dropped-fields gap only)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNameInUse is a sentinel for Create* operations whose Name/Arn is
	// already taken by a resource type that the real AWS API reports as
	// ResourceInUseException -- stream processors, projects, and project
	// versions -- as opposed to ResourceAlreadyExistsException (collections,
	// datasets) or ConflictException (users). Verified against
	// aws-sdk-go-v2/service/rekognition's per-operation deserializers.go
	// error switches (each generated Create* op only recognizes a specific
	// exception type; anything else deserializes as an untyped
	// smithy.GenericAPIError, breaking SDK-side `errors.As` typed matching).
	ErrNameInUse = errors.New("resource name already in use")
	// ErrUserConflict is returned when CreateUser is called with a UserId
	// that already exists; AWS reports this as ConflictException (not
	// ResourceAlreadyExistsException).
	ErrUserConflict = errors.New("user already exists")

	// ErrCollectionNotFound is returned when a collection does not exist.
	ErrCollectionNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrCollectionAlreadyExists is returned when a collection already exists.
	ErrCollectionAlreadyExists = awserr.New(errConflictException, awserr.ErrAlreadyExists)
	// ErrStreamProcessorNotFound is returned when a stream processor does not exist.
	ErrStreamProcessorNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrStreamProcessorAlreadyExists is returned when a stream processor already
	// exists. Maps to ResourceInUseException, not ResourceAlreadyExistsException.
	ErrStreamProcessorAlreadyExists = awserr.New(errResourceInUse, ErrNameInUse)
	// ErrFaceNotFound is returned when a face does not exist in a collection.
	ErrFaceNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrValidation is returned on invalid input.
	ErrValidation = awserr.New(errValidation, awserr.ErrInvalidParameter)
	// ErrUnknownOperation is returned when the requested operation is not implemented.
	ErrUnknownOperation = errors.New("unknown operation")

	// ErrProjectNotFound is returned when a project does not exist.
	ErrProjectNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrProjectAlreadyExists is returned when a project name is already in
	// use. Maps to ResourceInUseException (not ResourceAlreadyExistsException
	// -- see ErrNameInUse).
	ErrProjectAlreadyExists = awserr.New(errResourceInUse, ErrNameInUse)
	// ErrProjectVersionNotFound is returned when a project version does not exist.
	ErrProjectVersionNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrProjectVersionAlreadyExists is returned when a project version name
	// is already in use. Maps to ResourceInUseException (see ErrNameInUse).
	ErrProjectVersionAlreadyExists = awserr.New(errResourceInUse, ErrNameInUse)
	// ErrDatasetNotFound is returned when a dataset does not exist.
	ErrDatasetNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrDatasetAlreadyExists is returned when CreateDataset is called for a
	// project that already has a dataset of the requested DatasetType.
	// Maps to ResourceAlreadyExistsException, same exception type as
	// CreateCollection (verified against aws-sdk-go-v2/service/rekognition's
	// CreateDataset error deserializer switch -- see ErrNameInUse's doc
	// comment for why this varies per Create* op).
	ErrDatasetAlreadyExists = awserr.New(errResourceAlreadyExists, awserr.ErrAlreadyExists)
	// ErrUserNotFound is returned when a user does not exist.
	ErrUserNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrUserAlreadyExists is returned when a UserId is already registered
	// in the collection. Maps to ConflictException (not
	// ResourceAlreadyExistsException -- see ErrUserConflict).
	ErrUserAlreadyExists = awserr.New(errConflictException, ErrUserConflict)
	// ErrLivenessSessionNotFound is returned when a liveness session does not exist.
	ErrLivenessSessionNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrAsyncJobNotFound is returned when an async job does not exist.
	ErrAsyncJobNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrMediaAnalysisJobNotFound is returned when a media analysis job does not exist.
	ErrMediaAnalysisJobNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
)
View Source
var ErrNilAppContext = errors.New("rekognition: nil app context")

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

Functions

This section is empty.

Types

type AssociatedFace

type AssociatedFace struct {
	FaceID string
}

AssociatedFace is a face successfully associated to a user.

type AsyncJob

type AsyncJob struct {
	JobID     string
	JobStatus string
	NextToken string
}

AsyncJob represents a Rekognition async video analysis job.

type BoundingBox added in v1.2.0

type BoundingBox struct {
	Height *float32
	Left   *float32
	Top    *float32
	Width  *float32
}

BoundingBox mirrors AWS's types.BoundingBox: a rectangular region of interest.

type Collection

type Collection struct {
	CreationTimestamp time.Time
	Tags              map[string]string
	CollectionID      string
	CollectionARN     string
	FaceModelVersion  string
}

Collection represents an Amazon Rekognition face collection. CreationTimestamp is first so its non-pointer prefix reduces GC pointer bytes.

type CreateProjectVersionParams added in v1.2.0

type CreateProjectVersionParams struct {
	OutputConfigS3Bucket    string
	OutputConfigS3KeyPrefix string
	KmsKeyID                string
	VersionDescription      string
}

CreateProjectVersionParams groups CreateProjectVersionInput's fields beyond ProjectArn/VersionName/Tags (OutputConfig/KmsKeyId/ VersionDescription), so the CreateProjectVersion backend method signature stays manageable as fields are added. TrainingData/TestingData/ FeatureConfig (the external-manifest / feature-customization fields) are intentionally NOT modeled here -- see PARITY.md deferred: they describe a Custom Labels training-data manifest with no corresponding backing resource this in-memory backend can meaningfully echo back.

type CreateStreamProcessorParams added in v1.2.0

type CreateStreamProcessorParams struct {
	Input                 *StreamProcessorInput
	Output                *StreamProcessorOutput
	Settings              *StreamProcessorSettings
	NotificationChannel   *StreamProcessorNotificationChannel
	DataSharingPreference *StreamProcessorDataSharingPreference
	KmsKeyID              string
	RegionsOfInterest     []RegionOfInterest
}

CreateStreamProcessorParams groups CreateStreamProcessorInput's AWS-modeled fields beyond Name/RoleArn/Tags (Input/Output/Settings/ NotificationChannel/DataSharingPreference/RegionsOfInterest/KmsKeyId), so the CreateStreamProcessor backend method signature doesn't grow an unbounded positional parameter list as fields are added.

type Dataset

type Dataset struct {
	CreationTimestamp    time.Time
	LastUpdatedTimestamp time.Time
	DatasetARN           string
	ProjectARN           string
	DatasetType          string
	Status               string
	StatusMessage        string
}

Dataset represents a Rekognition Custom Labels dataset.

type DatasetDistribution

type DatasetDistribution struct {
	DatasetARN string
}

DatasetDistribution is a dataset reference for DistributeDatasetEntries.

type DatasetLabel

type DatasetLabel struct {
	LabelName  string
	EntryCount int64
}

DatasetLabel represents a label entry in a dataset.

type DisassociatedFace

type DisassociatedFace struct {
	FaceID string
}

DisassociatedFace is a face successfully disassociated from a user.

type Face

type Face struct {
	FaceID          string
	ImageID         string
	ExternalImageID string
	CollectionID    string
	Confidence      float64
}

Face represents an indexed face.

type FaceMatch

type FaceMatch struct {
	Face       *Face
	Similarity float64
}

FaceMatch represents a face match result.

type Handler

type Handler struct {
	Backend StorageBackend
	// contains filtered or unexported fields
}

Handler handles Rekognition HTTP requests using X-Amz-Target routing.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the operation name from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the resource identifier from the request body.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of 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 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. See Handler.Snapshot for why this delegation exists.

func (*Handler) RouteMatcher

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

RouteMatcher returns a matcher that accepts Rekognition X-Amz-Target headers.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

This delegation is itself the Phase 3.3 dead-wiring fix: before this change Handler had no Snapshot/Restore of its own, even though InMemoryBackend (via StorageBackend) always implemented both. cli.go's generic setupPersistence type-asserts the registered service.Registerable (the Handler returned by Provider.Init, not the backend) against a Snapshot/Restore-shaped interface, so without these two methods Rekognition was silently never persisted at all, matching the codecommit/codepipeline/emr pattern.

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 in-memory backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the account ID.

func (*InMemoryBackend) AssociateFaces

func (b *InMemoryBackend) AssociateFaces(
	collectionID, userID string, faceIDs []string,
) ([]*AssociatedFace, []*UnsuccessfulFaceAssociation, error)

AssociateFaces associates faces with a user.

func (*InMemoryBackend) CopyProjectVersion

func (b *InMemoryBackend) CopyProjectVersion(
	sourceProjectVersionARN, destinationProjectARN, versionName string,
) (*ProjectVersion, error)

CopyProjectVersion copies a project version to another project.

func (*InMemoryBackend) CreateCollection

func (b *InMemoryBackend) CreateCollection(collectionID string, tags map[string]string) (*Collection, error)

CreateCollection creates a new face collection.

func (*InMemoryBackend) CreateDataset

func (b *InMemoryBackend) CreateDataset(projectARN, datasetType string) (*Dataset, error)

CreateDataset creates a new dataset. Real AWS rejects a second dataset of the same DatasetType for a project with ResourceAlreadyExistsException; datasetARN is always uuid-suffixed (so two datasets of the same type never collide on table key), so that check must be done explicitly here via a scan for an existing (ProjectARN, DatasetType) pair.

func (*InMemoryBackend) CreateFaceLivenessSession

func (b *InMemoryBackend) CreateFaceLivenessSession() (string, error)

CreateFaceLivenessSession creates a new face liveness session.

func (*InMemoryBackend) CreateProject

func (b *InMemoryBackend) CreateProject(name string) (*Project, error)

CreateProject creates a new Rekognition Custom Labels project.

func (*InMemoryBackend) CreateProjectVersion

func (b *InMemoryBackend) CreateProjectVersion(
	projectARN, versionName string,
	params CreateProjectVersionParams,
	tags map[string]string,
) (*ProjectVersion, error)

CreateProjectVersion creates a new model version within a project. params carries CreateProjectVersionInput's fields beyond ProjectArn/VersionName/ Tags (OutputConfig/KmsKeyId/VersionDescription) -- all stored verbatim and returned unchanged by DescribeProjectVersions. tags are applied the same way CreateStreamProcessor applies its initial tags (b.tags keyed by ARN); ProjectVersion ARNs are taggable per TagResource's doc (see resourceExists in tags.go).

func (*InMemoryBackend) CreateStreamProcessor

func (b *InMemoryBackend) CreateStreamProcessor(
	name, roleARN string,
	params CreateStreamProcessorParams,
	tags map[string]string,
) (*StreamProcessor, error)

CreateStreamProcessor creates a new stream processor. params carries the AWS-modeled fields beyond Name/RoleArn/Tags (Input/Output/Settings/ NotificationChannel/DataSharingPreference/RegionsOfInterest/KmsKeyId) — all stored verbatim and returned unchanged by DescribeStreamProcessor.

func (*InMemoryBackend) CreateUser

func (b *InMemoryBackend) CreateUser(collectionID, userID string) error

CreateUser creates a user in a collection.

func (*InMemoryBackend) DeleteCollection

func (b *InMemoryBackend) DeleteCollection(collectionID string) error

DeleteCollection deletes a face collection.

func (*InMemoryBackend) DeleteDataset

func (b *InMemoryBackend) DeleteDataset(datasetARN string) error

DeleteDataset deletes a dataset.

func (*InMemoryBackend) DeleteFaces

func (b *InMemoryBackend) DeleteFaces(collectionID string, faceIDs []string) ([]string, error)

DeleteFaces removes faces from a collection.

func (*InMemoryBackend) DeleteProject

func (b *InMemoryBackend) DeleteProject(projectARN string) error

DeleteProject deletes a project.

func (*InMemoryBackend) DeleteProjectPolicy

func (b *InMemoryBackend) DeleteProjectPolicy(
	projectARN, policyName, policyRevisionID string,
) error

DeleteProjectPolicy deletes a project policy.

func (*InMemoryBackend) DeleteProjectVersion

func (b *InMemoryBackend) DeleteProjectVersion(projectVersionARN string) error

DeleteProjectVersion deletes a project version.

func (*InMemoryBackend) DeleteStreamProcessor

func (b *InMemoryBackend) DeleteStreamProcessor(name string) error

DeleteStreamProcessor deletes a stream processor.

func (*InMemoryBackend) DeleteUser

func (b *InMemoryBackend) DeleteUser(collectionID, userID string) error

DeleteUser removes a user from a collection.

func (*InMemoryBackend) DescribeCollection

func (b *InMemoryBackend) DescribeCollection(collectionID string) (*Collection, error)

DescribeCollection returns details about a collection.

func (*InMemoryBackend) DescribeDataset

func (b *InMemoryBackend) DescribeDataset(datasetARN string) (*Dataset, error)

DescribeDataset returns details about a dataset.

func (*InMemoryBackend) DescribeProjectVersions

func (b *InMemoryBackend) DescribeProjectVersions(
	projectARN string, versionNames []string, maxResults int32, nextToken string,
) ([]*ProjectVersion, string, error)

DescribeProjectVersions lists versions for a project, optionally filtered by version names.

func (*InMemoryBackend) DescribeProjects

func (b *InMemoryBackend) DescribeProjects(
	projectARNs []string, maxResults int32, nextToken string,
) ([]*Project, string, error)

DescribeProjects lists projects, optionally filtered by ARNs.

func (*InMemoryBackend) DescribeStreamProcessor

func (b *InMemoryBackend) DescribeStreamProcessor(name string) (*StreamProcessor, error)

DescribeStreamProcessor returns details about a stream processor.

func (*InMemoryBackend) DisassociateFaces

func (b *InMemoryBackend) DisassociateFaces(
	collectionID, userID string, faceIDs []string,
) ([]*DisassociatedFace, []*UnsuccessfulFaceDisassociation, error)

DisassociateFaces removes faces from a user.

func (*InMemoryBackend) DistributeDatasetEntries

func (b *InMemoryBackend) DistributeDatasetEntries(datasets []DatasetDistribution) error

DistributeDatasetEntries validates datasets and marks them as UPDATE_IN_PROGRESS.

func (*InMemoryBackend) GetAsyncJob

func (b *InMemoryBackend) GetAsyncJob(jobID string) (*AsyncJob, error)

GetAsyncJob returns an async job by ID, simulating state progression on each poll.

func (*InMemoryBackend) GetFaceLivenessSessionResults

func (b *InMemoryBackend) GetFaceLivenessSessionResults(sessionID string) (*LivenessSessionResult, error)

GetFaceLivenessSessionResults returns the result of a liveness session.

func (*InMemoryBackend) GetMediaAnalysisJob

func (b *InMemoryBackend) GetMediaAnalysisJob(jobID string) (*MediaAnalysisJob, error)

GetMediaAnalysisJob returns a media analysis job by ID.

func (*InMemoryBackend) IndexFaces

func (b *InMemoryBackend) IndexFaces(collectionID, externalImageID string) ([]*Face, error)

IndexFaces indexes faces into a collection (simulated — no real image processing).

func (*InMemoryBackend) ListCollections

func (b *InMemoryBackend) ListCollections(maxResults int32, nextToken string) ([]*Collection, string, error)

ListCollections returns a paginated list of collections.

func (*InMemoryBackend) ListDatasetEntries

func (b *InMemoryBackend) ListDatasetEntries(
	datasetARN string, maxResults int32, nextToken string,
) ([]string, string, error)

ListDatasetEntries returns a paginated list of dataset entries.

func (*InMemoryBackend) ListDatasetLabels

func (b *InMemoryBackend) ListDatasetLabels(
	datasetARN string, maxResults int32, nextToken string,
) ([]*DatasetLabel, string, error)

ListDatasetLabels parses stored dataset entries and returns labels with occurrence counts.

func (*InMemoryBackend) ListFaces

func (b *InMemoryBackend) ListFaces(collectionID string, maxResults int32, nextToken string) ([]*Face, string, error)

ListFaces returns a paginated list of faces in a collection.

func (*InMemoryBackend) ListMediaAnalysisJobs

func (b *InMemoryBackend) ListMediaAnalysisJobs(
	maxResults int32, nextToken string,
) ([]*MediaAnalysisJob, string, error)

ListMediaAnalysisJobs returns a paginated list of media analysis jobs.

func (*InMemoryBackend) ListProjectPolicies

func (b *InMemoryBackend) ListProjectPolicies(
	projectARN string, maxResults int32, nextToken string,
) ([]*ProjectPolicy, string, error)

ListProjectPolicies lists policies for a project.

func (*InMemoryBackend) ListStreamProcessors

func (b *InMemoryBackend) ListStreamProcessors(maxResults int32, nextToken string) ([]*StreamProcessor, string, error)

ListStreamProcessors returns a paginated list of stream processors.

func (*InMemoryBackend) ListTagsForResource

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

ListTagsForResource returns tags for a resource.

func (*InMemoryBackend) ListUsers

func (b *InMemoryBackend) ListUsers(
	collectionID string, maxResults int32, nextToken string,
) ([]*User, string, error)

ListUsers returns a paginated list of users in a collection.

func (*InMemoryBackend) PutProjectPolicy

func (b *InMemoryBackend) PutProjectPolicy(
	projectARN, policyName, policyDocument, policyRevisionID string,
) (string, error)

PutProjectPolicy creates or updates a project policy.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored state.

func (*InMemoryBackend) Restore

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

Restore deserializes backend state from JSON. It implements persistence.Persistable.

func (*InMemoryBackend) SearchFaces

func (b *InMemoryBackend) SearchFaces(collectionID, faceID string, maxFaces int32) ([]*FaceMatch, error)

SearchFaces searches for faces that match a given face ID.

func (*InMemoryBackend) SearchFacesByImage

func (b *InMemoryBackend) SearchFacesByImage(
	collectionID string,
	maxFaces int32,
	imageKey string,
) ([]*FaceMatch, error)

SearchFacesByImage searches for faces matching an image (simulated). imageKey is a stable string derived from the image reference (S3 path or byte length) and is used to vary similarity scores per image rather than returning a fixed value.

func (*InMemoryBackend) SearchUsers

func (b *InMemoryBackend) SearchUsers(collectionID, userID string, maxUsers int32) ([]*UserMatch, error)

SearchUsers returns up to maxUsers users with a simulated similarity score.

func (*InMemoryBackend) SearchUsersByImage

func (b *InMemoryBackend) SearchUsersByImage(
	collectionID string,
	maxUsers int32,
	imageKey string,
) ([]*UserMatch, error)

SearchUsersByImage returns up to maxUsers users with a deterministic similarity score derived from the image reference and each candidate user's identity.

func (*InMemoryBackend) Snapshot

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

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartAsyncJob

func (b *InMemoryBackend) StartAsyncJob(jobType, collectionID string) (string, error)

StartAsyncJob creates a new async video analysis job.

func (*InMemoryBackend) StartMediaAnalysisJob

func (b *InMemoryBackend) StartMediaAnalysisJob(jobName string) (string, error)

StartMediaAnalysisJob creates a new media analysis job.

func (*InMemoryBackend) StartProjectVersion

func (b *InMemoryBackend) StartProjectVersion(projectVersionARN string, minInferenceUnits int32) error

StartProjectVersion sets a project version status to RUNNING.

func (*InMemoryBackend) StartStreamProcessor

func (b *InMemoryBackend) StartStreamProcessor(name string) error

StartStreamProcessor starts a stream processor.

func (*InMemoryBackend) StopProjectVersion

func (b *InMemoryBackend) StopProjectVersion(projectVersionARN string) error

StopProjectVersion sets a project version status to STOPPED.

func (*InMemoryBackend) StopStreamProcessor

func (b *InMemoryBackend) StopStreamProcessor(name string) error

StopStreamProcessor stops a stream processor.

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, tagKeys []string) error

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateDatasetEntries

func (b *InMemoryBackend) UpdateDatasetEntries(datasetARN string, changes []byte) error

UpdateDatasetEntries appends changes to dataset entries.

func (*InMemoryBackend) UpdateStreamProcessor

func (b *InMemoryBackend) UpdateStreamProcessor(name string, params UpdateStreamProcessorParams) error

UpdateStreamProcessor applies UpdateStreamProcessorInput's update-only fields (DataSharingPreferenceForUpdate, ParametersToDelete, RegionsOfInterestForUpdate, SettingsForUpdate.ConnectedHomeForUpdate) to a stored stream processor. ParametersToDelete is applied last, so a delete always wins over a same-request set (matching AWS's documented behavior).

type LivenessSessionResult

type LivenessSessionResult struct {
	SessionID  string
	Status     string
	Confidence float32
}

LivenessSessionResult holds the result of a face liveness session.

type MediaAnalysisJob

type MediaAnalysisJob struct {
	CreationTimestamp time.Time
	JobID             string
	JobName           string
	Status            string
}

MediaAnalysisJob represents a Rekognition media analysis job.

type Point added in v1.2.0

type Point struct {
	X *float32
	Y *float32
}

Point mirrors AWS's types.Point: a single vertex of a RegionOfInterest polygon.

type Project

type Project struct {
	CreationTimestamp time.Time
	ProjectARN        string
	Status            string
}

Project represents a Rekognition Custom Labels project.

type ProjectPolicy

type ProjectPolicy struct {
	CreationTimestamp    time.Time
	LastUpdatedTimestamp time.Time
	ProjectARN           string
	PolicyName           string
	PolicyRevisionID     string
	PolicyDocument       string
}

ProjectPolicy represents a project policy.

type ProjectVersion

type ProjectVersion struct {
	CreationTimestamp       time.Time
	Tags                    map[string]string
	ProjectVersionARN       string
	ProjectARN              string
	VersionName             string
	Status                  string
	StatusMessage           string
	OutputConfigS3Bucket    string
	OutputConfigS3KeyPrefix string
	KmsKeyID                string
	VersionDescription      string
	MinInferenceUnits       int32
}

ProjectVersion represents a model version within a project.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon Rekognition.

func (*Provider) Init

Init initializes the Rekognition service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RegionOfInterest added in v1.2.0

type RegionOfInterest struct {
	BoundingBox *BoundingBox
	Polygon     []Point
}

RegionOfInterest mirrors AWS's types.RegionOfInterest: a box or polygon area a stream processor checks for objects/people.

type StorageBackend

type StorageBackend interface {
	CreateCollection(collectionID string, tags map[string]string) (*Collection, error)
	DeleteCollection(collectionID string) error
	DescribeCollection(collectionID string) (*Collection, error)
	ListCollections(maxResults int32, nextToken string) ([]*Collection, string, error)

	IndexFaces(collectionID, externalImageID string) ([]*Face, error)
	DeleteFaces(collectionID string, faceIDs []string) ([]string, error)
	ListFaces(collectionID string, maxResults int32, nextToken string) ([]*Face, string, error)
	SearchFaces(collectionID, faceID string, maxFaces int32) ([]*FaceMatch, error)
	SearchFacesByImage(collectionID string, maxFaces int32, imageKey string) ([]*FaceMatch, error)

	CreateStreamProcessor(
		name, roleARN string,
		params CreateStreamProcessorParams,
		tags map[string]string,
	) (*StreamProcessor, error)
	DeleteStreamProcessor(name string) error
	DescribeStreamProcessor(name string) (*StreamProcessor, error)
	ListStreamProcessors(maxResults int32, nextToken string) ([]*StreamProcessor, string, error)
	StartStreamProcessor(name string) error
	StopStreamProcessor(name string) error
	UpdateStreamProcessor(name string, params UpdateStreamProcessorParams) error

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

	// Projects and Project Versions
	CreateProject(name string) (*Project, error)
	DeleteProject(projectARN string) error
	DescribeProjects(projectARNs []string, maxResults int32, nextToken string) ([]*Project, string, error)
	CreateProjectVersion(
		projectARN, versionName string,
		params CreateProjectVersionParams,
		tags map[string]string,
	) (*ProjectVersion, error)
	DeleteProjectVersion(projectVersionARN string) error
	DescribeProjectVersions(projectARN string, versionNames []string, maxResults int32, nextToken string) (
		[]*ProjectVersion, string, error)
	CopyProjectVersion(sourceProjectVersionARN, destinationProjectARN, versionName string) (*ProjectVersion, error)
	StartProjectVersion(projectVersionARN string, minInferenceUnits int32) error
	StopProjectVersion(projectVersionARN string) error
	ListProjectPolicies(projectARN string, maxResults int32, nextToken string) ([]*ProjectPolicy, string, error)
	PutProjectPolicy(projectARN, policyName, policyDocument, policyRevisionID string) (string, error)
	DeleteProjectPolicy(projectARN, policyName, policyRevisionID string) error

	// Datasets
	CreateDataset(projectARN, datasetType string) (*Dataset, error)
	DeleteDataset(datasetARN string) error
	DescribeDataset(datasetARN string) (*Dataset, error)
	ListDatasetEntries(datasetARN string, maxResults int32, nextToken string) ([]string, string, error)
	ListDatasetLabels(datasetARN string, maxResults int32, nextToken string) ([]*DatasetLabel, string, error)
	UpdateDatasetEntries(datasetARN string, changes []byte) error
	DistributeDatasetEntries(datasets []DatasetDistribution) error

	// Users
	CreateUser(collectionID, userID string) error
	DeleteUser(collectionID, userID string) error
	ListUsers(collectionID string, maxResults int32, nextToken string) ([]*User, string, error)
	AssociateFaces(
		collectionID, userID string,
		faceIDs []string,
	) ([]*AssociatedFace, []*UnsuccessfulFaceAssociation, error)
	DisassociateFaces(
		collectionID, userID string,
		faceIDs []string,
	) ([]*DisassociatedFace, []*UnsuccessfulFaceDisassociation, error)
	SearchUsers(collectionID, userID string, maxUsers int32) ([]*UserMatch, error)
	SearchUsersByImage(collectionID string, maxUsers int32, imageKey string) ([]*UserMatch, error)

	// Face Liveness
	CreateFaceLivenessSession() (string, error)
	GetFaceLivenessSessionResults(sessionID string) (*LivenessSessionResult, error)

	// Async video jobs
	StartAsyncJob(jobType, collectionID string) (string, error)
	GetAsyncJob(jobID string) (*AsyncJob, error)
	StartMediaAnalysisJob(jobName string) (string, error)
	GetMediaAnalysisJob(jobID string) (*MediaAnalysisJob, error)
	ListMediaAnalysisJobs(maxResults int32, nextToken string) ([]*MediaAnalysisJob, string, error)

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

StorageBackend is the interface for Rekognition storage operations.

type StreamProcessor

type StreamProcessor struct {
	LastUpdateTimestamp   time.Time
	CreationTimestamp     time.Time
	Input                 *StreamProcessorInput
	Tags                  map[string]string
	DataSharingPreference *StreamProcessorDataSharingPreference
	NotificationChannel   *StreamProcessorNotificationChannel
	Settings              *StreamProcessorSettings
	Output                *StreamProcessorOutput
	Name                  string
	KmsKeyID              string
	StatusMessage         string
	Status                string
	RoleARN               string
	StreamProcessorARN    string
	RegionsOfInterest     []RegionOfInterest
}

StreamProcessor represents a Rekognition stream processor. Field order is fieldalignment-optimal (see `fieldalignment -fix`), not meaningful otherwise.

type StreamProcessorDataSharingPreference added in v1.2.0

type StreamProcessorDataSharingPreference struct {
	OptIn bool
}

StreamProcessorDataSharingPreference mirrors AWS's types.StreamProcessorDataSharingPreference.

type StreamProcessorInput added in v1.2.0

type StreamProcessorInput struct {
	KinesisVideoStreamARN string
}

StreamProcessorInput mirrors AWS's types.StreamProcessorInput: the Kinesis video stream that provides the source streaming video.

type StreamProcessorNotificationChannel added in v1.2.0

type StreamProcessorNotificationChannel struct {
	SNSTopicARN string
}

StreamProcessorNotificationChannel mirrors AWS's types.StreamProcessorNotificationChannel.

type StreamProcessorOutput added in v1.2.0

type StreamProcessorOutput struct {
	KinesisDataStreamARN string
	S3Bucket             string
	S3KeyPrefix          string
}

StreamProcessorOutput mirrors AWS's types.StreamProcessorOutput: either a Kinesis data stream (face search) or an S3 destination (label detection).

type StreamProcessorSettings added in v1.2.0

type StreamProcessorSettings struct {
	ConnectedHomeMinConfidence   *float32
	FaceSearchFaceMatchThreshold *float32
	FaceSearchCollectionID       string
	ConnectedHomeLabels          []string
}

StreamProcessorSettings mirrors AWS's types.StreamProcessorSettings: either ConnectedHome (label detection) or FaceSearch settings.

type UnsuccessfulFaceAssociation

type UnsuccessfulFaceAssociation struct {
	FaceID  string
	Reasons []string
}

UnsuccessfulFaceAssociation represents a face that couldn't be associated.

type UnsuccessfulFaceDisassociation

type UnsuccessfulFaceDisassociation struct {
	FaceID  string
	Reasons []string
}

UnsuccessfulFaceDisassociation represents a face that couldn't be disassociated.

type UpdateStreamProcessorParams added in v1.2.0

type UpdateStreamProcessorParams struct {
	DataSharingPreference      *StreamProcessorDataSharingPreference
	ConnectedHomeMinConfidence *float32
	ParametersToDelete         []string
	RegionsOfInterest          []RegionOfInterest
	ConnectedHomeLabels        []string
}

UpdateStreamProcessorParams groups UpdateStreamProcessorInput's update-only fields. Presence/absence is signaled the same way the AWS wire shape does: a nil pointer/slice means "leave unchanged", a non-nil (possibly empty) pointer/slice means "the caller supplied this field". ParametersToDelete additionally clears RegionsOfInterest or ConnectedHomeMinConfidence regardless of what else is set, matching AWS's documented apply-then-delete semantics.

type User

type User struct {
	UserID     string
	UserStatus string
}

User represents a Rekognition user in a collection.

type UserMatch

type UserMatch struct {
	User       *User
	Similarity float64
}

UserMatch represents a user match result.

Jump to

Keyboard shortcuts

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