1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. ApiShieldSchema
Cloudflare v5.49.1 published on Tuesday, Feb 18, 2025 by Pulumi

cloudflare.ApiShieldSchema

Explore with Pulumi AI

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 std from "@pulumi/std";

const petstoreSchema = new cloudflare.ApiShieldSchema("petstore_schema", {
    zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
    name: "myschema",
    kind: "openapi_v3",
    validationEnabled: true,
    source: std.file({
        input: "./schemas/petstore.json",
    }).then(invoke => invoke.result),
});
Copy
import pulumi
import pulumi_cloudflare as cloudflare
import pulumi_std as std

petstore_schema = cloudflare.ApiShieldSchema("petstore_schema",
    zone_id="0da42c8d2132a9ddaf714f9e7c920711",
    name="myschema",
    kind="openapi_v3",
    validation_enabled=True,
    source=std.file(input="./schemas/petstore.json").result)
Copy
package main

import (
	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "./schemas/petstore.json",
		}, nil)
		if err != nil {
			return err
		}
		_, err = cloudflare.NewApiShieldSchema(ctx, "petstore_schema", &cloudflare.ApiShieldSchemaArgs{
			ZoneId:            pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
			Name:              pulumi.String("myschema"),
			Kind:              pulumi.String("openapi_v3"),
			ValidationEnabled: pulumi.Bool(true),
			Source:            pulumi.String(invokeFile.Result),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var petstoreSchema = new Cloudflare.ApiShieldSchema("petstore_schema", new()
    {
        ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
        Name = "myschema",
        Kind = "openapi_v3",
        ValidationEnabled = true,
        Source = Std.File.Invoke(new()
        {
            Input = "./schemas/petstore.json",
        }).Apply(invoke => invoke.Result),
    });

});
Copy
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(StdFunctions.file(FileArgs.builder()
                .input("./schemas/petstore.json")
                .build()).result())
            .build());

    }
}
Copy
resources:
  petstoreSchema:
    type: cloudflare:ApiShieldSchema
    name: petstore_schema
    properties:
      zoneId: 0da42c8d2132a9ddaf714f9e7c920711
      name: myschema
      kind: openapi_v3
      validationEnabled: true # optional, default false
      source:
        fn::invoke:
          function: std:file
          arguments:
            input: ./schemas/petstore.json
          return: result
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. ApiShieldSchemaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. ApiShieldSchemaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ApiShieldSchemaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApiShieldSchemaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor 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,
});
Copy
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),
})
Copy
var apiShieldSchemaResource = new ApiShieldSchema("apiShieldSchemaResource", ApiShieldSchemaArgs.builder()
    .name("string")
    .source("string")
    .zoneId("string")
    .kind("string")
    .validationEnabled(false)
    .build());
Copy
api_shield_schema_resource = cloudflare.ApiShieldSchema("apiShieldSchemaResource",
    name="string",
    source="string",
    zone_id="string",
    kind="string",
    validation_enabled=False)
Copy
const apiShieldSchemaResource = new cloudflare.ApiShieldSchema("apiShieldSchemaResource", {
    name: "string",
    source: "string",
    zoneId: "string",
    kind: "string",
    validationEnabled: false,
});
Copy
type: cloudflare:ApiShieldSchema
properties:
    kind: string
    name: string
    source: string
    validationEnabled: false
    zoneId: string
Copy

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

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApiShieldSchema resource accepts the following input properties:

Name
This property is required.
Changes to this property will trigger replacement.
string
Name of the schema. Modifying this attribute will force creation of a new resource.
Source
This property is required.
Changes to this property will trigger replacement.
string
Schema file bytes. Modifying this attribute will force creation of a new resource.
ZoneId
This property is required.
Changes to this property will trigger replacement.
string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
Kind Changes to this property will trigger replacement. 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
This property is required.
Changes to this property will trigger replacement.
string
Name of the schema. Modifying this attribute will force creation of a new resource.
Source
This property is required.
Changes to this property will trigger replacement.
string
Schema file bytes. Modifying this attribute will force creation of a new resource.
ZoneId
This property is required.
Changes to this property will trigger replacement.
string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
Kind Changes to this property will trigger replacement. 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
This property is required.
Changes to this property will trigger replacement.
String
Name of the schema. Modifying this attribute will force creation of a new resource.
source
This property is required.
Changes to this property will trigger replacement.
String
Schema file bytes. Modifying this attribute will force creation of a new resource.
zoneId
This property is required.
Changes to this property will trigger replacement.
String
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. 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
This property is required.
Changes to this property will trigger replacement.
string
Name of the schema. Modifying this attribute will force creation of a new resource.
source
This property is required.
Changes to this property will trigger replacement.
string
Schema file bytes. Modifying this attribute will force creation of a new resource.
zoneId
This property is required.
Changes to this property will trigger replacement.
string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. 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
This property is required.
Changes to this property will trigger replacement.
str
Name of the schema. Modifying this attribute will force creation of a new resource.
source
This property is required.
Changes to this property will trigger replacement.
str
Schema file bytes. Modifying this attribute will force creation of a new resource.
zone_id
This property is required.
Changes to this property will trigger replacement.
str
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. 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
This property is required.
Changes to this property will trigger replacement.
String
Name of the schema. Modifying this attribute will force creation of a new resource.
source
This property is required.
Changes to this property will trigger replacement.
String
Schema file bytes. Modifying this attribute will force creation of a new resource.
zoneId
This property is required.
Changes to this property will trigger replacement.
String
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. 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)
resources:  _:    type: cloudflare:ApiShieldSchema    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 Changes to this property will trigger replacement. string
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
Name Changes to this property will trigger replacement. string
Name of the schema. Modifying this attribute will force creation of a new resource.
Source Changes to this property will trigger replacement. string
Schema file bytes. Modifying this attribute will force creation of a new resource.
ValidationEnabled bool
Flag whether schema is enabled for validation.
ZoneId Changes to this property will trigger replacement. string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
Kind Changes to this property will trigger replacement. string
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
Name Changes to this property will trigger replacement. string
Name of the schema. Modifying this attribute will force creation of a new resource.
Source Changes to this property will trigger replacement. string
Schema file bytes. Modifying this attribute will force creation of a new resource.
ValidationEnabled bool
Flag whether schema is enabled for validation.
ZoneId Changes to this property will trigger replacement. string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. String
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
name Changes to this property will trigger replacement. String
Name of the schema. Modifying this attribute will force creation of a new resource.
source Changes to this property will trigger replacement. String
Schema file bytes. Modifying this attribute will force creation of a new resource.
validationEnabled Boolean
Flag whether schema is enabled for validation.
zoneId Changes to this property will trigger replacement. String
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. string
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
name Changes to this property will trigger replacement. string
Name of the schema. Modifying this attribute will force creation of a new resource.
source Changes to this property will trigger replacement. string
Schema file bytes. Modifying this attribute will force creation of a new resource.
validationEnabled boolean
Flag whether schema is enabled for validation.
zoneId Changes to this property will trigger replacement. string
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. str
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
name Changes to this property will trigger replacement. str
Name of the schema. Modifying this attribute will force creation of a new resource.
source Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. str
The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
kind Changes to this property will trigger replacement. String
Kind of schema. Defaults to openapi_v3. Modifying this attribute will force creation of a new resource.
name Changes to this property will trigger replacement. String
Name of the schema. Modifying this attribute will force creation of a new resource.
source Changes to this property will trigger replacement. String
Schema file bytes. Modifying this attribute will force creation of a new resource.
validationEnabled Boolean
Flag whether schema is enabled for validation.
zoneId Changes to this property will trigger replacement. 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.