Class StreamProcessor


  • public class StreamProcessor
    extends com.pulumi.resources.CustomResource
    Resource for managing an AWS Rekognition Stream Processor. > This resource must be configured specifically for your use case, and not all options are compatible with one another. See [Stream Processor API documentation](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateStreamProcessor.html#rekognition-CreateStreamProcessor-request-Input) for configuration information. > Stream Processors configured for Face Recognition cannot have _any_ properties updated after the fact, and it will result in an AWS API error. ## Example Usage ### Label Detection
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.s3.Bucket;
     import com.pulumi.aws.s3.BucketArgs;
     import com.pulumi.aws.sns.Topic;
     import com.pulumi.aws.sns.TopicArgs;
     import com.pulumi.aws.kinesis.VideoStream;
     import com.pulumi.aws.kinesis.VideoStreamArgs;
     import com.pulumi.aws.iam.Role;
     import com.pulumi.aws.iam.RoleArgs;
     import com.pulumi.aws.iam.inputs.RoleInlinePolicyArgs;
     import com.pulumi.aws.rekognition.StreamProcessor;
     import com.pulumi.aws.rekognition.StreamProcessorArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorDataSharingPreferenceArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorOutputArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorOutputS3DestinationArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorSettingsArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorSettingsConnectedHomeArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorInputArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorInputKinesisVideoStreamArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorNotificationChannelArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new Bucket("example", BucketArgs.builder()
                 .bucket("example-bucket")
                 .build());
     
             var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
                 .name("example-topic")
                 .build());
     
             var exampleVideoStream = new VideoStream("exampleVideoStream", VideoStreamArgs.builder()
                 .name("example-kinesis-input")
                 .dataRetentionInHours(1)
                 .deviceName("kinesis-video-device-name")
                 .mediaType("video/h264")
                 .build());
     
             var exampleRole = new Role("exampleRole", RoleArgs.builder()
                 .inlinePolicies(RoleInlinePolicyArgs.builder()
                     .name("Rekognition-Access")
                     .policy(Output.tuple(example.arn(), exampleTopic.arn(), exampleVideoStream.arn()).applyValue(values -> {
                         var exampleArn = values.t1;
                         var exampleTopicArn = values.t2;
                         var exampleVideoStreamArn = values.t3;
                         return serializeJson(
                             jsonObject(
                                 jsonProperty("Version", "2012-10-17"),
                                 jsonProperty("Statement", jsonArray(
                                     jsonObject(
                                         jsonProperty("Action", jsonArray("s3:PutObject")),
                                         jsonProperty("Effect", "Allow"),
                                         jsonProperty("Resource", jsonArray(String.format("%s/*", exampleArn)))
                                     ), 
                                     jsonObject(
                                         jsonProperty("Action", jsonArray("sns:Publish")),
                                         jsonProperty("Effect", "Allow"),
                                         jsonProperty("Resource", jsonArray(exampleTopicArn))
                                     ), 
                                     jsonObject(
                                         jsonProperty("Action", jsonArray(
                                             "kinesis:Get*", 
                                             "kinesis:DescribeStreamSummary"
                                         )),
                                         jsonProperty("Effect", "Allow"),
                                         jsonProperty("Resource", jsonArray(exampleVideoStreamArn))
                                     )
                                 ))
                             ));
                     }))
                     .build())
                 .name("example-role")
                 .assumeRolePolicy(serializeJson(
                     jsonObject(
                         jsonProperty("Version", "2012-10-17"),
                         jsonProperty("Statement", jsonArray(jsonObject(
                             jsonProperty("Action", "sts:AssumeRole"),
                             jsonProperty("Effect", "Allow"),
                             jsonProperty("Principal", jsonObject(
                                 jsonProperty("Service", "rekognition.amazonaws.com")
                             ))
                         )))
                     )))
                 .build());
     
             var exampleStreamProcessor = new StreamProcessor("exampleStreamProcessor", StreamProcessorArgs.builder()
                 .dataSharingPreference(StreamProcessorDataSharingPreferenceArgs.builder()
                     .optIn(false)
                     .build())
                 .output(StreamProcessorOutputArgs.builder()
                     .s3Destination(StreamProcessorOutputS3DestinationArgs.builder()
                         .bucket(example.bucket())
                         .build())
                     .build())
                 .settings(StreamProcessorSettingsArgs.builder()
                     .connectedHome(StreamProcessorSettingsConnectedHomeArgs.builder()
                         .labels(                    
                             "PERSON",
                             "PET")
                         .build())
                     .build())
                 .input(StreamProcessorInputArgs.builder()
                     .kinesisVideoStream(StreamProcessorInputKinesisVideoStreamArgs.builder()
                         .arn(exampleVideoStream.arn())
                         .build())
                     .build())
                 .notificationChannel(StreamProcessorNotificationChannelArgs.builder()
                     .snsTopicArn(exampleTopic.arn())
                     .build())
                 .roleArn(exampleRole.arn())
                 .name("example-processor")
                 .build());
     
         }
     }
     
     
    ### Face Detection Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.kinesis.VideoStream;
     import com.pulumi.aws.kinesis.VideoStreamArgs;
     import com.pulumi.aws.kinesis.Stream;
     import com.pulumi.aws.kinesis.StreamArgs;
     import com.pulumi.aws.kinesis.inputs.StreamStreamModeDetailsArgs;
     import com.pulumi.aws.iam.Role;
     import com.pulumi.aws.iam.RoleArgs;
     import com.pulumi.aws.iam.inputs.RoleInlinePolicyArgs;
     import com.pulumi.aws.rekognition.Collection;
     import com.pulumi.aws.rekognition.CollectionArgs;
     import com.pulumi.aws.rekognition.StreamProcessor;
     import com.pulumi.aws.rekognition.StreamProcessorArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorDataSharingPreferenceArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorInputArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorInputKinesisVideoStreamArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorOutputArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorOutputKinesisDataStreamArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorSettingsArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorSettingsFaceSearchArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorRegionsOfInterestArgs;
     import com.pulumi.aws.rekognition.inputs.StreamProcessorRegionsOfInterestPolygonArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new VideoStream("example", VideoStreamArgs.builder()
                 .name("example-kinesis-input")
                 .dataRetentionInHours(1)
                 .deviceName("kinesis-video-device-name")
                 .mediaType("video/h264")
                 .build());
     
             var exampleStream = new Stream("exampleStream", StreamArgs.builder()
                 .streamModeDetails(StreamStreamModeDetailsArgs.builder()
                     .streamMode("ON_DEMAND")
                     .build())
                 .name("pulumi-kinesis-example")
                 .build());
     
             var exampleRole = new Role("exampleRole", RoleArgs.builder()
                 .inlinePolicies(RoleInlinePolicyArgs.builder()
                     .name("Rekognition-Access")
                     .policy(Output.tuple(example.arn(), exampleStream.arn()).applyValue(values -> {
                         var exampleArn = values.t1;
                         var exampleStreamArn = values.t2;
                         return serializeJson(
                             jsonObject(
                                 jsonProperty("Version", "2012-10-17"),
                                 jsonProperty("Statement", jsonArray(
                                     jsonObject(
                                         jsonProperty("Action", jsonArray(
                                             "kinesis:Get*", 
                                             "kinesis:DescribeStreamSummary"
                                         )),
                                         jsonProperty("Effect", "Allow"),
                                         jsonProperty("Resource", jsonArray(exampleArn))
                                     ), 
                                     jsonObject(
                                         jsonProperty("Action", jsonArray("kinesis:PutRecord")),
                                         jsonProperty("Effect", "Allow"),
                                         jsonProperty("Resource", jsonArray(exampleStreamArn))
                                     )
                                 ))
                             ));
                     }))
                     .build())
                 .name("example-role")
                 .assumeRolePolicy(serializeJson(
                     jsonObject(
                         jsonProperty("Version", "2012-10-17"),
                         jsonProperty("Statement", jsonArray(jsonObject(
                             jsonProperty("Action", "sts:AssumeRole"),
                             jsonProperty("Effect", "Allow"),
                             jsonProperty("Principal", jsonObject(
                                 jsonProperty("Service", "rekognition.amazonaws.com")
                             ))
                         )))
                     )))
                 .build());
     
             var exampleCollection = new Collection("exampleCollection", CollectionArgs.builder()
                 .collectionId("example-collection")
                 .build());
     
             var exampleStreamProcessor = new StreamProcessor("exampleStreamProcessor", StreamProcessorArgs.builder()
                 .dataSharingPreference(StreamProcessorDataSharingPreferenceArgs.builder()
                     .optIn(false)
                     .build())
                 .input(StreamProcessorInputArgs.builder()
                     .kinesisVideoStream(StreamProcessorInputKinesisVideoStreamArgs.builder()
                         .arn(example.arn())
                         .build())
                     .build())
                 .output(StreamProcessorOutputArgs.builder()
                     .kinesisDataStream(StreamProcessorOutputKinesisDataStreamArgs.builder()
                         .arn(exampleStream.arn())
                         .build())
                     .build())
                 .settings(StreamProcessorSettingsArgs.builder()
                     .faceSearch(StreamProcessorSettingsFaceSearchArgs.builder()
                         .collectionId(exampleCollection.id())
                         .build())
                     .build())
                 .regionsOfInterests(StreamProcessorRegionsOfInterestArgs.builder()
                     .polygons(                
                         StreamProcessorRegionsOfInterestPolygonArgs.builder()
                             .x(0.5)
                             .y(0.5)
                             .build(),
                         StreamProcessorRegionsOfInterestPolygonArgs.builder()
                             .x(0.5)
                             .y(0.5)
                             .build(),
                         StreamProcessorRegionsOfInterestPolygonArgs.builder()
                             .x(0.5)
                             .y(0.5)
                             .build())
                     .build())
                 .roleArn(exampleRole.arn())
                 .name("example-processor")
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `name` (String) Name of the Stream Processor. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import Rekognition Stream Processor using the `name`. For example: ```sh $ pulumi import aws:rekognition/streamProcessor:StreamProcessor example my-stream ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Detail

      • StreamProcessor

        public StreamProcessor​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • StreamProcessor

        public StreamProcessor​(java.lang.String name,
                               StreamProcessorArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • StreamProcessor

        public StreamProcessor​(java.lang.String name,
                               StreamProcessorArgs args,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the Stream Processor.
      • input

        public com.pulumi.core.Output<StreamProcessorInput> input()
        Returns:
        Input video stream. See `input`.
      • kmsKeyId

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> kmsKeyId()
        Returns:
        Optional parameter for label detection stream processors.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the Stream Processor.
      • notificationChannel

        public com.pulumi.core.Output<java.util.Optional<StreamProcessorNotificationChannel>> notificationChannel()
        Returns:
        Amazon Simple Notification Service topic to which Amazon Rekognition publishes the completion status. See `notificationChannel`.
      • output

        public com.pulumi.core.Output<StreamProcessorOutput> output()
        Returns:
        Kinesis data stream stream or Amazon S3 bucket location to which Amazon Rekognition Video puts the analysis results. See `output`.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • regionsOfInterests

        public com.pulumi.core.Output<java.util.Optional<java.util.List<StreamProcessorRegionsOfInterest>>> regionsOfInterests()
        Returns:
        Locations in the frames where Amazon Rekognition checks for objects or people. See `regionsOfInterest`.
      • roleArn

        public com.pulumi.core.Output<java.lang.String> roleArn()
        Returns:
        Amazon Resource Number (ARN) of the IAM role that allows access to the stream processor. The IAM role provides Rekognition read permissions for a Kinesis stream. It also provides write permissions to an Amazon S3 bucket and Amazon Simple Notification Service topic for a label detection stream processor. This is required for both face search and label detection stream processors.
      • settings

        public com.pulumi.core.Output<StreamProcessorSettings> settings()
        Returns:
        Input parameters used in a streaming video analyzed by a stream processor. See `settings`. The following arguments are optional:
      • streamProcessorArn

        public com.pulumi.core.Output<java.lang.String> streamProcessorArn()
        Returns:
        (**Deprecated**) ARN of the Stream Processor. Use `arn` instead.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • get

        public static StreamProcessor get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          StreamProcessorState state,
                                          @Nullable
                                          com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.