1. Packages
  2. Aiven
  3. API Docs
  4. KafkaSchema
Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi

aiven.KafkaSchema

Explore with Pulumi AI

aiven logo
Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi

    The Kafka Schema resource allows the creation and management of Aiven Kafka Schemas.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const kafka_schema1 = new aiven.KafkaSchema("kafka-schema1", {
        project: aiven_project["kafka-schemas-project1"].project,
        serviceName: aiven_kafka["kafka-service1"].service_name,
        subjectName: "kafka-schema1",
        compatibilityLevel: "FORWARD",
        schema: `    {
          "doc": "example",
          "fields": [
            {
              "default": 5,
              "doc": "my test number",
              "name": "test",
              "namespace": "test",
              "type": "int"
            }
          ],
          "name": "example",
          "namespace": "example",
          "type": "record"
        }
    `,
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    kafka_schema1 = aiven.KafkaSchema("kafka-schema1",
        project=aiven_project["kafka-schemas-project1"]["project"],
        service_name=aiven_kafka["kafka-service1"]["service_name"],
        subject_name="kafka-schema1",
        compatibility_level="FORWARD",
        schema="""    {
          "doc": "example",
          "fields": [
            {
              "default": 5,
              "doc": "my test number",
              "name": "test",
              "namespace": "test",
              "type": "int"
            }
          ],
          "name": "example",
          "namespace": "example",
          "type": "record"
        }
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aiven.NewKafkaSchema(ctx, "kafka-schema1", &aiven.KafkaSchemaArgs{
    			Project:            pulumi.Any(aiven_project.KafkaSchemasProject1.Project),
    			ServiceName:        pulumi.Any(aiven_kafka.KafkaService1.Service_name),
    			SubjectName:        pulumi.String("kafka-schema1"),
    			CompatibilityLevel: pulumi.String("FORWARD"),
    			Schema: pulumi.String(`    {
          "doc": "example",
          "fields": [
            {
              "default": 5,
              "doc": "my test number",
              "name": "test",
              "namespace": "test",
              "type": "int"
            }
          ],
          "name": "example",
          "namespace": "example",
          "type": "record"
        }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var kafka_schema1 = new Aiven.KafkaSchema("kafka-schema1", new()
        {
            Project = aiven_project.Kafka_schemas_project1.Project,
            ServiceName = aiven_kafka.Kafka_service1.Service_name,
            SubjectName = "kafka-schema1",
            CompatibilityLevel = "FORWARD",
            Schema = @"    {
          ""doc"": ""example"",
          ""fields"": [
            {
              ""default"": 5,
              ""doc"": ""my test number"",
              ""name"": ""test"",
              ""namespace"": ""test"",
              ""type"": ""int""
            }
          ],
          ""name"": ""example"",
          ""namespace"": ""example"",
          ""type"": ""record""
        }
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.KafkaSchema;
    import com.pulumi.aiven.KafkaSchemaArgs;
    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 kafka_schema1 = new KafkaSchema("kafka-schema1", KafkaSchemaArgs.builder()        
                .project(aiven_project.kafka-schemas-project1().project())
                .serviceName(aiven_kafka.kafka-service1().service_name())
                .subjectName("kafka-schema1")
                .compatibilityLevel("FORWARD")
                .schema("""
        {
          "doc": "example",
          "fields": [
            {
              "default": 5,
              "doc": "my test number",
              "name": "test",
              "namespace": "test",
              "type": "int"
            }
          ],
          "name": "example",
          "namespace": "example",
          "type": "record"
        }
                """)
                .build());
    
        }
    }
    
    resources:
      kafka-schema1:
        type: aiven:KafkaSchema
        properties:
          project: ${aiven_project"kafka-schemas-project1"[%!s(MISSING)].project}
          serviceName: ${aiven_kafka"kafka-service1"[%!s(MISSING)].service_name}
          subjectName: kafka-schema1
          compatibilityLevel: FORWARD
          schema: |2
                {
                  "doc": "example",
                  "fields": [
                    {
                      "default": 5,
                      "doc": "my test number",
                      "name": "test",
                      "namespace": "test",
                      "type": "int"
                    }
                  ],
                  "name": "example",
                  "namespace": "example",
                  "type": "record"
                }
    

    Create KafkaSchema Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new KafkaSchema(name: string, args: KafkaSchemaArgs, opts?: CustomResourceOptions);
    @overload
    def KafkaSchema(resource_name: str,
                    args: KafkaSchemaArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def KafkaSchema(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    project: Optional[str] = None,
                    schema: Optional[str] = None,
                    service_name: Optional[str] = None,
                    subject_name: Optional[str] = None,
                    compatibility_level: Optional[str] = None,
                    schema_type: Optional[str] = None)
    func NewKafkaSchema(ctx *Context, name string, args KafkaSchemaArgs, opts ...ResourceOption) (*KafkaSchema, error)
    public KafkaSchema(string name, KafkaSchemaArgs args, CustomResourceOptions? opts = null)
    public KafkaSchema(String name, KafkaSchemaArgs args)
    public KafkaSchema(String name, KafkaSchemaArgs args, CustomResourceOptions options)
    
    type: aiven:KafkaSchema
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args KafkaSchemaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args KafkaSchemaArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args KafkaSchemaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KafkaSchemaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KafkaSchemaArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var kafkaSchemaResource = new Aiven.KafkaSchema("kafkaSchemaResource", new()
    {
        Project = "string",
        Schema = "string",
        ServiceName = "string",
        SubjectName = "string",
        CompatibilityLevel = "string",
        SchemaType = "string",
    });
    
    example, err := aiven.NewKafkaSchema(ctx, "kafkaSchemaResource", &aiven.KafkaSchemaArgs{
    	Project:            pulumi.String("string"),
    	Schema:             pulumi.String("string"),
    	ServiceName:        pulumi.String("string"),
    	SubjectName:        pulumi.String("string"),
    	CompatibilityLevel: pulumi.String("string"),
    	SchemaType:         pulumi.String("string"),
    })
    
    var kafkaSchemaResource = new KafkaSchema("kafkaSchemaResource", KafkaSchemaArgs.builder()        
        .project("string")
        .schema("string")
        .serviceName("string")
        .subjectName("string")
        .compatibilityLevel("string")
        .schemaType("string")
        .build());
    
    kafka_schema_resource = aiven.KafkaSchema("kafkaSchemaResource",
        project="string",
        schema="string",
        service_name="string",
        subject_name="string",
        compatibility_level="string",
        schema_type="string")
    
    const kafkaSchemaResource = new aiven.KafkaSchema("kafkaSchemaResource", {
        project: "string",
        schema: "string",
        serviceName: "string",
        subjectName: "string",
        compatibilityLevel: "string",
        schemaType: "string",
    });
    
    type: aiven:KafkaSchema
    properties:
        compatibilityLevel: string
        project: string
        schema: string
        schemaType: string
        serviceName: string
        subjectName: string
    

    KafkaSchema Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The KafkaSchema resource accepts the following input properties:

    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    Schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    SubjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    CompatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    SchemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    Schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    SubjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    CompatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    SchemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema String
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName String
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    compatibilityLevel String
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    schemaType String
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    compatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    schemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema str
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subject_name str
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    compatibility_level str
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    schema_type str
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema String
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName String
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    compatibilityLevel String
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    schemaType String
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the KafkaSchema resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Version int
    Kafka Schema configuration version.
    Id string
    The provider-assigned unique ID for this managed resource.
    Version int
    Kafka Schema configuration version.
    id String
    The provider-assigned unique ID for this managed resource.
    version Integer
    Kafka Schema configuration version.
    id string
    The provider-assigned unique ID for this managed resource.
    version number
    Kafka Schema configuration version.
    id str
    The provider-assigned unique ID for this managed resource.
    version int
    Kafka Schema configuration version.
    id String
    The provider-assigned unique ID for this managed resource.
    version Number
    Kafka Schema configuration version.

    Look up Existing KafkaSchema Resource

    Get an existing KafkaSchema resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: KafkaSchemaState, opts?: CustomResourceOptions): KafkaSchema
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compatibility_level: Optional[str] = None,
            project: Optional[str] = None,
            schema: Optional[str] = None,
            schema_type: Optional[str] = None,
            service_name: Optional[str] = None,
            subject_name: Optional[str] = None,
            version: Optional[int] = None) -> KafkaSchema
    func GetKafkaSchema(ctx *Context, name string, id IDInput, state *KafkaSchemaState, opts ...ResourceOption) (*KafkaSchema, error)
    public static KafkaSchema Get(string name, Input<string> id, KafkaSchemaState? state, CustomResourceOptions? opts = null)
    public static KafkaSchema get(String name, Output<String> id, KafkaSchemaState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CompatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    Schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    SchemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    SubjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    Version int
    Kafka Schema configuration version.
    CompatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    Schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    SchemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    SubjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    Version int
    Kafka Schema configuration version.
    compatibilityLevel String
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema String
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    schemaType String
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName String
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    version Integer
    Kafka Schema configuration version.
    compatibilityLevel string
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema string
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    schemaType string
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName string
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    version number
    Kafka Schema configuration version.
    compatibility_level str
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema str
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    schema_type str
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subject_name str
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    version int
    Kafka Schema configuration version.
    compatibilityLevel String
    Kafka Schemas compatibility level. The possible values are BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE and NONE.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    schema String
    Kafka Schema configuration. Should be a valid Avro, JSON, or Protobuf schema, depending on the schema type.
    schemaType String
    Kafka Schema configuration type. Defaults to AVRO. Possible values are AVRO, JSON, and PROTOBUF.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    subjectName String
    The Kafka Schema Subject name. Changing this property forces recreation of the resource.
    version Number
    Kafka Schema configuration version.

    Import

    $ pulumi import aiven:index/kafkaSchema:KafkaSchema kafka-schema1 project/service_name/subject_name
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi