DocumentClassifier class

Resource for managing an AWS Comprehend Document Classifier.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const documents = new aws.s3.BucketObjectv2("documents", {});
const example = new aws.comprehend.DocumentClassifier("example", {
    inputDataConfig: {
        s3Uri: pulumi.interpolate`s3://${test.bucket}/${documents.key}`,
    },
    name: "example",
    dataAccessRoleArn: exampleAwsIamRole.arn,
    languageCode: "en",
}, {
    dependsOn: [exampleAwsIamRolePolicy],
});
const entities = new aws.s3.BucketObjectv2("entities", {});
import pulumi
import pulumi_aws as aws

documents = aws.s3.BucketObjectv2("documents")
example = aws.comprehend.DocumentClassifier("example",
    input_data_config={
        "s3_uri": documents.key.apply(lambda key: f"s3://{test['bucket']}/{key}"),
    },
    name="example",
    data_access_role_arn=example_aws_iam_role["arn"],
    language_code="en",
    opts = pulumi.ResourceOptions(depends_on=[example_aws_iam_role_policy]))
entities = aws.s3.BucketObjectv2("entities")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var documents = new Aws.S3.BucketObjectv2("documents");

    var example = new Aws.Comprehend.DocumentClassifier("example", new()
    {
        InputDataConfig = new Aws.Comprehend.Inputs.DocumentClassifierInputDataConfigArgs
        {
            S3Uri = documents.Key.Apply(key => $"s3://{test.Bucket}/{key}"),
        },
        Name = "example",
        DataAccessRoleArn = exampleAwsIamRole.Arn,
        LanguageCode = "en",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleAwsIamRolePolicy,
        },
    });

    var entities = new Aws.S3.BucketObjectv2("entities");

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/comprehend"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		documents, err := s3.NewBucketObjectv2(ctx, "documents", nil)
		if err != nil {
			return err
		}
		_, err = comprehend.NewDocumentClassifier(ctx, "example", &comprehend.DocumentClassifierArgs{
			InputDataConfig: &comprehend.DocumentClassifierInputDataConfigArgs{
				S3Uri: documents.Key.ApplyT(func(key string) (string, error) {
					return fmt.Sprintf("s3://%v/%v", test.Bucket, key), nil
				}).(pulumi.StringOutput),
			},
			Name:              pulumi.String("example"),
			DataAccessRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
			LanguageCode:      pulumi.String("en"),
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleAwsIamRolePolicy,
		}))
		if err != nil {
			return err
		}
		_, err = s3.NewBucketObjectv2(ctx, "entities", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_comprehend_documentclassifier" "example" {
  depends_on = [exampleAwsIamRolePolicy]
  input_data_config = {
    s3_uri ="s3://${test.bucket}/${aws_s3_bucketobjectv2.documents.key}"
  }
  name                 = "example"
  data_access_role_arn = exampleAwsIamRole.arn
  language_code        = "en"
}
resource "aws_s3_bucketobjectv2" "documents" {
}
resource "aws_s3_bucketobjectv2" "entities" {
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketObjectv2;
import com.pulumi.aws.comprehend.DocumentClassifier;
import com.pulumi.aws.comprehend.DocumentClassifierArgs;
import com.pulumi.aws.comprehend.inputs.DocumentClassifierInputDataConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
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 documents = new BucketObjectv2("documents");

        var example = new DocumentClassifier("example", DocumentClassifierArgs.builder()
            .inputDataConfig(DocumentClassifierInputDataConfigArgs.builder()
                .s3Uri(documents.key().applyValue(_key -> String.format("s3://%s/%s", test.bucket(),_key)))
                .build())
            .name("example")
            .dataAccessRoleArn(exampleAwsIamRole.arn())
            .languageCode("en")
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleAwsIamRolePolicy)
                .build());

        var entities = new BucketObjectv2("entities");

    }
}
resources:
  example:
    type: aws:comprehend:DocumentClassifier
    properties:
      inputDataConfig:
        s3Uri: s3://${test.bucket}/${documents.key}
      name: example
      dataAccessRoleArn: ${exampleAwsIamRole.arn}
      languageCode: en
    options:
      dependsOn:
        - ${exampleAwsIamRolePolicy}
  documents:
    type: aws:s3:BucketObjectv2
  entities:
    type: aws:s3:BucketObjectv2

Import

Identity Schema

Required

  • arn (String) ARN of the Comprehend document classifier.

Using pulumi import, import Comprehend Document Classifier using the ARN. For example:

$ pulumi import aws:comprehend/documentClassifier:DocumentClassifier example arn:aws:comprehend:us-west-2:123456789012:document_classifier/example

Constructors

DocumentClassifier(String name, {DocumentClassifierArgs? args, CustomResourceOptions? options})
Creates a new DocumentClassifier. name The Pulumi resource name. args Arguments used to configure this DocumentClassifier. The set of arguments for DocumentClassifier. options Resource options controlling this resource's behavior.
DocumentClassifier.reference(String urn)
Creates a typed reference to an existing DocumentClassifier resource.

Properties

arn ↔ Output<String>
ARN of the Document Classifier version.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
dataAccessRoleArn ↔ Output<String>
The ARN for an IAM Role which allows Comprehend to read the training and testing data.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
inputDataConfig ↔ Output<DocumentClassifierInputDataConfig>
Configuration for the training and testing data. See the inputDataConfig Configuration Block section below.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
languageCode ↔ Output<String>
Two-letter language code for the language. One of en, es, fr, it, de, or pt.
latefinal
mode ↔ Output<String?>
The document classification mode. One of MULTI_CLASS or MULTI_LABEL. MULTI_CLASS is also known as "Single Label" in the AWS Console.
latefinal
modelKmsKeyId ↔ Output<String?>
KMS Key used to encrypt trained Document Classifiers. Can be a KMS Key ID or a KMS Key ARN.
latefinal
name ↔ Output<String>
Name for the Document Classifier. Has a maximum length of 63 characters. Can contain upper- and lower-case letters, numbers, and hypen (-).
latefinal
outputDataConfig ↔ Output<DocumentClassifierOutputDataConfig>
Configuration for the output results of training. See the outputDataConfig Configuration Block section below.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A 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.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
versionName ↔ Output<String>
Name for the version of the Document Classifier. Each version must have a unique name within the Document Classifier. If omitted, the provider will assign a random, unique version name. If explicitly set to "", no version name will be set. Has a maximum length of 63 characters. Can contain upper- and lower-case letters, numbers, and hypen (-). Conflicts with versionNamePrefix.
latefinal
versionNamePrefix ↔ Output<String>
Creates a unique version name beginning with the specified prefix. Has a maximum length of 37 characters. Can contain upper- and lower-case letters, numbers, and hypen (-). Conflicts with versionName.
latefinal
volumeKmsKeyId ↔ Output<String?>
KMS Key used to encrypt storage volumes during job processing. Can be a KMS Key ID or a KMS Key ARN.
latefinal
vpcConfig ↔ Output<DocumentClassifierVpcConfig?>
Configuration parameters for VPC to contain Document Classifier resources. See the vpcConfig Configuration Block section below.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {DocumentClassifierState? state, CustomResourceOptions? options}) DocumentClassifier
Gets an existing DocumentClassifier resource's state with the given name and id.