Schema class

Provides an EventBridge Schema resource.

> Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.

Example Usage

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

const test = new aws.schemas.Registry("test", {name: "my_own_registry"});
const testSchema = new aws.schemas.Schema("test", {
    name: "my_schema",
    registryName: test.name,
    type: "OpenApi3",
    description: "The schema definition for my event",
    content: JSON.stringify({
        openapi: "3.0.0",
        info: {
            version: "1.0.0",
            title: "Event",
        },
        paths: {},
        components: {
            schemas: {
                Event: {
                    type: "object",
                    properties: {
                        name: {
                            type: "string",
                        },
                    },
                },
            },
        },
    }),
});
import pulumi
import json
import pulumi_aws as aws

test = aws.schemas.Registry("test", name="my_own_registry")
test_schema = aws.schemas.Schema("test",
    name="my_schema",
    registry_name=test.name,
    type="OpenApi3",
    description="The schema definition for my event",
    content=json.dumps({
        "openapi": "3.0.0",
        "info": {
            "version": "1.0.0",
            "title": "Event",
        },
        "paths": {},
        "components": {
            "schemas": {
                "Event": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "string",
                        },
                    },
                },
            },
        },
    }))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var test = new Aws.Schemas.Registry("test", new()
    {
        Name = "my_own_registry",
    });

    var testSchema = new Aws.Schemas.Schema("test", new()
    {
        Name = "my_schema",
        RegistryName = test.Name,
        Type = "OpenApi3",
        Description = "The schema definition for my event",
        Content = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["openapi"] = "3.0.0",
            ["info"] = new Dictionary<string, object?>
            {
                ["version"] = "1.0.0",
                ["title"] = "Event",
            },
            ["paths"] = new Dictionary<string, object?>
            {
            },
            ["components"] = new Dictionary<string, object?>
            {
                ["schemas"] = new Dictionary<string, object?>
                {
                    ["Event"] = new Dictionary<string, object?>
                    {
                        ["type"] = "object",
                        ["properties"] = new Dictionary<string, object?>
                        {
                            ["name"] = new Dictionary<string, object?>
                            {
                                ["type"] = "string",
                            },
                        },
                    },
                },
            },
        }),
    });

});
package main

import (
	"encoding/json"

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := schemas.NewRegistry(ctx, "test", &schemas.RegistryArgs{
			Name: pulumi.String("my_own_registry"),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"openapi": "3.0.0",
			"info": map[string]string{
				"version": "1.0.0",
				"title":   "Event",
			},
			"paths": map[string]interface{}{},
			"components": map[string]map[string]map[string]interface{}{
				"schemas": map[string]map[string]interface{}{
					"Event": map[string]interface{}{
						"type": "object",
						"properties": map[string]map[string]string{
							"name": map[string]string{
								"type": "string",
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = schemas.NewSchema(ctx, "test", &schemas.SchemaArgs{
			Name:         pulumi.String("my_schema"),
			RegistryName: test.Name,
			Type:         pulumi.String("OpenApi3"),
			Description:  pulumi.String("The schema definition for my event"),
			Content:      pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_schemas_registry" "test" {
  name = "my_own_registry"
}
resource "aws_schemas_schema" "test" {
  name          = "my_schema"
  registry_name = aws_schemas_registry.test.name
  type          = "OpenApi3"
  description   = "The schema definition for my event"
  content = jsonencode({
    "openapi" = "3.0.0"
    "info" = {
      "version" = "1.0.0"
      "title"   = "Event"
    }
    "paths" = {}
    "components" = {
      "schemas" = {
        "Event" = {
          "type" = "object"
          "properties" = {
            "name" = {
              "type" = "string"
            }
          }
        }
      }
    }
  })
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.schemas.Registry;
import com.pulumi.aws.schemas.RegistryArgs;
import com.pulumi.aws.schemas.Schema;
import com.pulumi.aws.schemas.SchemaArgs;
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 test = new Registry("test", RegistryArgs.builder()
            .name("my_own_registry")
            .build());

        var testSchema = new Schema("testSchema", SchemaArgs.builder()
            .name("my_schema")
            .registryName(test.name())
            .type("OpenApi3")
            .description("The schema definition for my event")
            .content(serializeJson(
                jsonObject(
                    jsonProperty("openapi", "3.0.0"),
                    jsonProperty("info", jsonObject(
                        jsonProperty("version", "1.0.0"),
                        jsonProperty("title", "Event")
                    )),
                    jsonProperty("paths", jsonObject(

                    )),
                    jsonProperty("components", jsonObject(
                        jsonProperty("schemas", jsonObject(
                            jsonProperty("Event", jsonObject(
                                jsonProperty("type", "object"),
                                jsonProperty("properties", jsonObject(
                                    jsonProperty("name", jsonObject(
                                        jsonProperty("type", "string")
                                    ))
                                ))
                            ))
                        ))
                    ))
                )))
            .build());

    }
}
resources:
  test:
    type: aws:schemas:Registry
    properties:
      name: my_own_registry
  testSchema:
    type: aws:schemas:Schema
    name: test
    properties:
      name: my_schema
      registryName: ${test.name}
      type: OpenApi3
      description: The schema definition for my event
      content:
        fn::toJSON:
          openapi: 3.0.0
          info:
            version: 1.0.0
            title: Event
          paths: {}
          components:
            schemas:
              Event:
                type: object
                properties:
                  name:
                    type: string

Import

Using pulumi import, import EventBridge schema using the name and registryName. For example:

$ pulumi import aws:schemas/schema:Schema test name/registry

Constructors

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

Properties

arn ↔ Output<String>
ARN of the discoverer.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
content ↔ Output<String>
The schema specification. Must be a valid Open API 3.0 spec.
latefinal
description ↔ Output<String?>
The description of the schema. Maximum of 256 characters.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
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
lastModified ↔ Output<String>
The last modified date of the schema.
latefinal
name ↔ Output<String>
The name of the schema. Maximum of 385 characters consisting of lower case letters, upper case letters, ., -, _, @.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
registryName ↔ Output<String>
The name of the registry in which this schema belongs.
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
type ↔ Output<String>
The type of the schema. Valid values: OpenApi3 or JSONSchemaDraft4.
latefinal
urn ↔ Output<String>
latefinalinherited
version ↔ Output<String>
The version of the schema.
latefinal
versionCreatedDate ↔ Output<String>
The created date of the version of the schema.
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, {SchemaState? state, CustomResourceOptions? options}) → Schema
Gets an existing Schema resource's state with the given name and id.