rekognition

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 20 Imported by: 0

README

Rekognition

Parity grade: A · SDK aws-sdk-go-v2/service/rekognition@v1.54.4 · last audited 2026-08-10 (903d74b67)

Coverage

Metric Value
Operations audited 50 (49 ok, 1 partial)
Feature families 3 (3 ok)
Known gaps 1
Deferred items 4
Resource leaks clean
Known gaps
  • CreateProjectVersion still drops TrainingData/TestingData contents (Custom Labels external-manifest structures: TrainingData/TestingData -> []Asset -> GroundTruthManifest -> S3Object, 3-4 levels, no unions, structurally simple but pointless to store -- the only place they'd resurface is TrainingDataResult/TestingDataResult, which requires a training-completion lifecycle this backend never reaches; both-or-neither presence is still cross-validated) — see Notes #6
Deferred
  • ProjectVersionDescription's BaseModelVersion (needs data this emulator cannot have: an AWS-internal base-model-catalog string, not derivable or user-supplied) and BillableTrainingTimeInSeconds/TrainingEndTimestamp/EvaluationResult/ManifestSummary/TestingDataResult/TrainingDataResult (needs a lifecycle that does not exist: all are documented as populated only once training completes, and this backend's Status never advances past TRAINING_IN_PROGRESS; EvaluationResult additionally requires a fabricated F1 score, which the no-fabrication rule forbids outright) — see Notes #6
  • ProjectVersionDescription.Feature / DescribeProjects' Feature (large mechanical surface deferred for size: Feature is set at CreateProject time, which does not currently accept or store it at all; modeling ProjectVersionDescription.Feature honestly requires a CreateProject signature change cascading through DescribeProjects too, a separate op family from this sweep's CreateProjectVersion/StartProjectVersion/CopyProjectVersion scope) — see Notes #6
  • SegmentTypeInfo.ModelVersion (needs data this emulator cannot have: AWS-internal segment-detection model build string) — Type is modeled, ModelVersion is not, see Notes #6
  • Detection-result arrays (Celebrities/ModerationLabels/Faces/Labels/Persons/Segments/TextDetections) stay synthesized-empty; acceptable per the ML-mock exemption, not individually wire-diffed field-by-field this sweep (this sweep's scope was CreateProjectVersion/ProjectVersionDescription/async-video envelope fields, not the ML detection payloads themselves)

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
	JobTag         string
	VideoS3Bucket  string
	VideoS3Name    string
	VideoS3Version string
	SegmentTypes   []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
	UserCount         int64
}

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

type CopyProjectVersionParams added in v1.3.1

type CopyProjectVersionParams struct {
	SourceProjectARN        string
	OutputConfigS3Bucket    string
	OutputConfigS3KeyPrefix string
}

CopyProjectVersionParams groups CopyProjectVersionInput's fields beyond SourceProjectVersionArn/DestinationProjectArn/VersionName: SourceProjectArn (the source project the copied version must belong to) and OutputConfig (where the copied training results are stored in the destination account).

type CreateProjectParams added in v1.3.1

type CreateProjectParams struct {
	AutoUpdate string
	Feature    string
}

CreateProjectParams groups CreateProjectInput's fields beyond ProjectName/Tags. Feature defaults to CUSTOM_LABELS when empty per api_op_CreateProject.go's documented "If no value is provided CUSTOM_LABELS is used as a default." AutoUpdate has no documented default, so an empty value is stored and echoed back as empty rather than guessed.

type CreateProjectVersionParams added in v1.2.0

type CreateProjectVersionParams struct {
	FeatureConfigContentModConfidenceThresh *float32
	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. FeatureConfigContentModConfidenceThresh is CustomizationFeatureConfig.ContentModeration.ConfidenceThreshold, a 2-level struct with no unions (types.go:486,495) -- shallow enough to model verbatim. TrainingData/TestingData are intentionally NOT modeled: both reference an external Custom Labels S3 manifest that this in-memory backend never trains against, so there is nowhere downstream (TrainingDataResult/ TestingDataResult require a training-completion lifecycle this backend doesn't have) to surface a stored copy -- see PARITY.md deferred. Their presence is still cross-validated (see handleCreateProjectVersion).

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
	Stats                DatasetStats
}

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 DatasetStats added in v1.3.1

type DatasetStats struct {
	TotalEntries   int64
	LabeledEntries int64
	TotalLabels    int64
	ErrorEntries   int64
}

DatasetStats mirrors types.DatasetStats (TotalEntries/LabeledEntries/ TotalLabels, computed from the dataset's stored manifest entries; ErrorEntries is always 0 -- this backend has no entry-level error concept, so 0 is the accurate value, not a fabrication).

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,
	params CopyProjectVersionParams,
) (*ProjectVersion, error)

CopyProjectVersion copies a project version to another project. The source version must belong to params.SourceProjectARN -- AWS reports a mismatch the same way it reports any other missing source, ResourceNotFoundException (verified against CopyProjectVersion's deserializeOpError switch, which declares ResourceNotFoundException but no ValidationException).

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, params CreateProjectParams) (*Project, error)

CreateProject creates a new Rekognition Custom Labels project.

CreateProjectInput.Tags is deliberately NOT accepted here: unlike Collection/StreamProcessor/model tags, TagResource's and ListTagsForResource's own docs scope ResourceArn to "the model, collection, or stream processor" -- Project ARNs are absent from both, so this backend's own API surface has no read path that could ever observe project tags, real or fabricated. Left disclosed rather than half-wired.

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(
	projectNames []string, maxResults int32, nextToken string,
) ([]*Project, string, error)

DescribeProjects lists projects, optionally filtered by name. DescribeProjectsInput.ProjectNames filters by name (see storedProject's doc comment), not by ARN -- there is no ProjectArns filter member on the real input at all.

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(params StartAsyncJobParams) (string, error)

StartAsyncJob creates a new async video analysis job.

func (*InMemoryBackend) StartMediaAnalysisJob

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

StartMediaAnalysisJob creates a new media analysis job.

func (*InMemoryBackend) StartProjectVersion

func (b *InMemoryBackend) StartProjectVersion(
	projectVersionARN string, minInferenceUnits, maxInferenceUnits 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) TaggedResources added in v1.3.1

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

TaggedResources returns every collection, stream processor, and project version ARN that currently has at least one tag applied via TagResource.

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
	DetectModerationLabelsMinConfidence  *float32
	JobID                                string
	JobName                              string
	Status                               string
	InputS3Bucket                        string
	InputS3Name                          string
	InputS3Version                       string
	OutputConfigS3Bucket                 string
	OutputConfigS3KeyPrefix              string
	DetectModerationLabelsProjectVersion string
	HasDetectModerationLabels            bool
}

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
	AutoUpdate        string
	Feature           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
	FeatureConfigContentModConfidenceThresh *float32
	StatusMessage                           string
	VersionName                             string
	Status                                  string
	ProjectARN                              string
	OutputConfigS3Bucket                    string
	OutputConfigS3KeyPrefix                 string
	KmsKeyID                                string
	VersionDescription                      string
	SourceProjectVersionARN                 string
	ProjectVersionARN                       string
	MinInferenceUnits                       int32
	MaxInferenceUnits                       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 StartAsyncJobParams added in v1.3.1

type StartAsyncJobParams struct {
	JobType        string
	CollectionID   string
	JobTag         string
	VideoS3Bucket  string
	VideoS3Name    string
	VideoS3Version string
	SegmentTypes   []string
}

StartAsyncJobParams groups the StartXxx request fields common to every async video job family (Video/JobTag are echoed back verbatim by the matching GetXxx response; SegmentTypes only applies to StartSegmentDetection but is harmless zero-valued for the others).

type StartMediaAnalysisJobParams added in v1.3.1

type StartMediaAnalysisJobParams struct {
	DetectModerationLabelsMinConfidence  *float32
	InputS3Bucket                        string
	InputS3Name                          string
	InputS3Version                       string
	OutputConfigS3Bucket                 string
	OutputConfigS3KeyPrefix              string
	DetectModerationLabelsProjectVersion string
	HasDetectModerationLabels            bool
}

StartMediaAnalysisJobParams groups StartMediaAnalysisJobInput's required Input/OperationsConfig/OutputConfig members beyond JobName, so the StartMediaAnalysisJob backend method signature stays manageable.

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, params CreateProjectParams) (*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,
		params CopyProjectVersionParams,
	) (*ProjectVersion, error)
	StartProjectVersion(projectVersionARN string, minInferenceUnits, maxInferenceUnits 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(params StartAsyncJobParams) (string, error)
	GetAsyncJob(jobID string) (*AsyncJob, error)
	StartMediaAnalysisJob(jobName string, params StartMediaAnalysisJobParams) (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 TaggedEntry added in v1.3.1

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

TaggedEntry pairs a resource ARN with its tags.

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