1. Packages
  2. Cloudflare
  3. API Docs
  4. ApiShieldSchema
Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi

cloudflare.ApiShieldSchema

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a resource to manage a schema in API Shield Schema Validation 2.0.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    import * as fs from "fs";
    
    const petstoreSchema = new cloudflare.ApiShieldSchema("petstoreSchema", {
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
        name: "myschema",
        kind: "openapi_v3",
        validationEnabled: true,
        source: fs.readFileSync("./schemas/petstore.json", "utf8"),
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    petstore_schema = cloudflare.ApiShieldSchema("petstoreSchema",
        zone_id="0da42c8d2132a9ddaf714f9e7c920711",
        name="myschema",
        kind="openapi_v3",
        validation_enabled=True,
        source=(lambda path: open(path).read())("./schemas/petstore.json"))
    
    package main
    
    import (
    	"os"
    
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewApiShieldSchema(ctx, "petstoreSchema", &cloudflare.ApiShieldSchemaArgs{
    			ZoneId:            pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    			Name:              pulumi.String("myschema"),
    			Kind:              pulumi.String("openapi_v3"),
    			ValidationEnabled: pulumi.Bool(true),
    			Source:            readFileOrPanic("./schemas/petstore.json"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var petstoreSchema = new Cloudflare.ApiShieldSchema("petstoreSchema", new()
        {
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
            Name = "myschema",
            Kind = "openapi_v3",
            ValidationEnabled = true,
            Source = File.ReadAllText("./schemas/petstore.json"),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.ApiShieldSchema;
    import com.pulumi.cloudflare.ApiShieldSchemaArgs;
    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 petstoreSchema = new ApiShieldSchema("petstoreSchema", ApiShieldSchemaArgs.builder()        
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .name("myschema")
                .kind("openapi_v3")
                .validationEnabled(true)
                .source(Files.readString(Paths.get("./schemas/petstore.json")))
                .build());
    
        }
    }
    
    resources:
      petstoreSchema:
        type: cloudflare:ApiShieldSchema
        properties:
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
          name: myschema
          kind: openapi_v3
          # optional
          validationEnabled: true
          # optional, default false
          source:
            fn::readFile: ./schemas/petstore.json
    

    Create ApiShieldSchema Resource

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

    Constructor syntax

    new ApiShieldSchema(name: string, args: ApiShieldSchemaArgs, opts?: CustomResourceOptions);
    @overload
    def ApiShieldSchema(resource_name: str,
                        args: ApiShieldSchemaArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiShieldSchema(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        name: Optional[str] = None,
                        source: Optional[str] = None,
                        zone_id: Optional[str] = None,
                        kind: Optional[str] = None,
                        validation_enabled: Optional[bool] = None)
    func NewApiShieldSchema(ctx *Context, name string, args ApiShieldSchemaArgs, opts ...ResourceOption) (*ApiShieldSchema, error)
    public ApiShieldSchema(string name, ApiShieldSchemaArgs args, CustomResourceOptions? opts = null)
    public ApiShieldSchema(String name, ApiShieldSchemaArgs args)
    public ApiShieldSchema(String name, ApiShieldSchemaArgs args, CustomResourceOptions options)
    
    type: cloudflare:ApiShieldSchema
    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 ApiShieldSchemaArgs
    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 ApiShieldSchemaArgs
    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 ApiShieldSchemaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiShieldSchemaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiShieldSchemaArgs
    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 apiShieldSchemaResource = new Cloudflare.ApiShieldSchema("apiShieldSchemaResource", new()
    {
        Name = "string",
        Source = "string",
        ZoneId = "string",
        Kind = "string",
        ValidationEnabled = false,
    });
    
    example, err := cloudflare.NewApiShieldSchema(ctx, "apiShieldSchemaResource", &cloudflare.ApiShieldSchemaArgs{
    	Name:              pulumi.String("string"),
    	Source:            pulumi.String("string"),
    	ZoneId:            pulumi.String("string"),
    	Kind:              pulumi.String("string"),
    	ValidationEnabled: pulumi.Bool(false),
    })
    
    var apiShieldSchemaResource = new ApiShieldSchema("apiShieldSchemaResource", ApiShieldSchemaArgs.builder()        
        .name("string")
        .source("string")
        .zoneId("string")
        .kind("string")
        .validationEnabled(false)
        .build());
    
    api_shield_schema_resource = cloudflare.ApiShieldSchema("apiShieldSchemaResource",
        name="string",
        source="string",
        zone_id="string",
        kind="string",
        validation_enabled=False)
    
    const apiShieldSchemaResource = new cloudflare.ApiShieldSchema("apiShieldSchemaResource", {
        name: "string",
        source: "string",
        zoneId: "string",
        kind: "string",
        validationEnabled: false,
    });
    
    type: cloudflare:ApiShieldSchema
    properties:
        kind: string
        name: string
        source: string
        validationEnabled: false
        zoneId: string
    

    ApiShieldSchema 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 ApiShieldSchema resource accepts the following input properties:

    Name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    Source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    ValidationEnabled bool
    Flag whether schema is enabled for validation.
    Name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    Source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    ValidationEnabled bool
    Flag whether schema is enabled for validation.
    name String
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source String
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind String
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    validationEnabled Boolean
    Flag whether schema is enabled for validation.
    name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    validationEnabled boolean
    Flag whether schema is enabled for validation.
    name str
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source str
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind str
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    validation_enabled bool
    Flag whether schema is enabled for validation.
    name String
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source String
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind String
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    validationEnabled Boolean
    Flag whether schema is enabled for validation.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ApiShieldSchema Resource

    Get an existing ApiShieldSchema 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?: ApiShieldSchemaState, opts?: CustomResourceOptions): ApiShieldSchema
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            kind: Optional[str] = None,
            name: Optional[str] = None,
            source: Optional[str] = None,
            validation_enabled: Optional[bool] = None,
            zone_id: Optional[str] = None) -> ApiShieldSchema
    func GetApiShieldSchema(ctx *Context, name string, id IDInput, state *ApiShieldSchemaState, opts ...ResourceOption) (*ApiShieldSchema, error)
    public static ApiShieldSchema Get(string name, Input<string> id, ApiShieldSchemaState? state, CustomResourceOptions? opts = null)
    public static ApiShieldSchema get(String name, Output<String> id, ApiShieldSchemaState 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:
    Kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    Name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    Source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    ValidationEnabled bool
    Flag whether schema is enabled for validation.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    Name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    Source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    ValidationEnabled bool
    Flag whether schema is enabled for validation.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind String
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    name String
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source String
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    validationEnabled Boolean
    Flag whether schema is enabled for validation.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind string
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    name string
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source string
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    validationEnabled boolean
    Flag whether schema is enabled for validation.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind str
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    name str
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source str
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    validation_enabled bool
    Flag whether schema is enabled for validation.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    kind String
    Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
    name String
    Name of the schema. Modifying this attribute will force creation of a new resource.
    source String
    Schema file bytes. Modifying this attribute will force creation of a new resource.
    validationEnabled Boolean
    Flag whether schema is enabled for validation.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi