All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.schemas.kotlin.SchemaArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.schemas.kotlin

import com.pulumi.aws.schemas.SchemaArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides an EventBridge Schema resource.
 * > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
 * ## Example Usage
 * 
 * ```typescript
 * 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",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     }),
 * });
 * ```
 * ```python
 * 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",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     }))
 * ```
 * ```csharp
 * 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
 *         {
 *             ["openapi"] = "3.0.0",
 *             ["info"] = new Dictionary
 *             {
 *                 ["version"] = "1.0.0",
 *                 ["title"] = "Event",
 *             },
 *             ["paths"] = new Dictionary
 *             {
 *             },
 *             ["components"] = new Dictionary
 *             {
 *                 ["schemas"] = new Dictionary
 *                 {
 *                     ["Event"] = new Dictionary
 *                     {
 *                         ["type"] = "object",
 *                         ["properties"] = new Dictionary
 *                         {
 *                             ["name"] = new Dictionary
 *                             {
 *                                 ["type"] = "string",
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *         }),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"encoding/json"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/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]interface{}{
 * 				"version": "1.0.0",
 * 				"title":   "Event",
 * 			},
 * 			"paths": map[string]interface{}{},
 * 			"components": map[string]interface{}{
 * 				"schemas": map[string]interface{}{
 * 					"Event": map[string]interface{}{
 * 						"type": "object",
 * 						"properties": map[string]interface{}{
 * 							"name": map[string]interface{}{
 * 								"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
 * 	})
 * }
 * ```
 * ```java
 * 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.List;
 * import java.util.ArrayList;
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * 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 `registry_name`. For example:
 * ```sh
 * $ pulumi import aws:schemas/schema:Schema test name/registry
 * ```
 * @property content The schema specification. Must be a valid Open API 3.0 spec.
 * @property description The description of the schema. Maximum of 256 characters.
 * @property name The name of the schema. Maximum of 385 characters consisting of lower case letters, upper case letters, ., -, _, @.
 * @property registryName The name of the registry in which this schema belongs.
 * @property tags A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 * @property type The type of the schema. Valid values: `OpenApi3` or `JSONSchemaDraft4`.
 */
public data class SchemaArgs(
    public val content: Output? = null,
    public val description: Output? = null,
    public val name: Output? = null,
    public val registryName: Output? = null,
    public val tags: Output>? = null,
    public val type: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.schemas.SchemaArgs =
        com.pulumi.aws.schemas.SchemaArgs.builder()
            .content(content?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .registryName(registryName?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .type(type?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SchemaArgs].
 */
@PulumiTagMarker
public class SchemaArgsBuilder internal constructor() {
    private var content: Output? = null

    private var description: Output? = null

    private var name: Output? = null

    private var registryName: Output? = null

    private var tags: Output>? = null

    private var type: Output? = null

    /**
     * @param value The schema specification. Must be a valid Open API 3.0 spec.
     */
    @JvmName("oxuqqahqsjsyjbtg")
    public suspend fun content(`value`: Output) {
        this.content = value
    }

    /**
     * @param value The description of the schema. Maximum of 256 characters.
     */
    @JvmName("waiehkywpaxglhla")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value The name of the schema. Maximum of 385 characters consisting of lower case letters, upper case letters, ., -, _, @.
     */
    @JvmName("hpxagaybrybuefsn")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the registry in which this schema belongs.
     */
    @JvmName("fxcmvubaqsdpptor")
    public suspend fun registryName(`value`: Output) {
        this.registryName = value
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("elenfaduhuhqnjec")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The type of the schema. Valid values: `OpenApi3` or `JSONSchemaDraft4`.
     */
    @JvmName("ppkujoukkhalevft")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value The schema specification. Must be a valid Open API 3.0 spec.
     */
    @JvmName("boawiukpbkwauoya")
    public suspend fun content(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.content = mapped
    }

    /**
     * @param value The description of the schema. Maximum of 256 characters.
     */
    @JvmName("ypwkwpxsvdispvum")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value The name of the schema. Maximum of 385 characters consisting of lower case letters, upper case letters, ., -, _, @.
     */
    @JvmName("ydiviricuepfibbu")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the registry in which this schema belongs.
     */
    @JvmName("mwgeposaafegoogg")
    public suspend fun registryName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.registryName = mapped
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("bsdstkscajuemmhw")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("rrwlpsgpepulknwj")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The type of the schema. Valid values: `OpenApi3` or `JSONSchemaDraft4`.
     */
    @JvmName("pqekiltvdvitqvrf")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): SchemaArgs = SchemaArgs(
        content = content,
        description = description,
        name = name,
        registryName = registryName,
        tags = tags,
        type = type,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy