Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.14.0 published on Thursday, Jul 28, 2022 by Pulumi

ApiSchema

Manages an API Schema within an API Management Service.

Example Usage

using System.IO;
using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleApi = Output.Create(Azure.ApiManagement.GetApi.InvokeAsync(new Azure.ApiManagement.GetApiArgs
        {
            Name = "search-api",
            ApiManagementName = "search-api-management",
            ResourceGroupName = "search-service",
            Revision = "2",
        }));
        var exampleApiSchema = new Azure.ApiManagement.ApiSchema("exampleApiSchema", new Azure.ApiManagement.ApiSchemaArgs
        {
            ApiName = exampleApi.Apply(exampleApi => exampleApi.Name),
            ApiManagementName = exampleApi.Apply(exampleApi => exampleApi.ApiManagementName),
            ResourceGroupName = exampleApi.Apply(exampleApi => exampleApi.ResourceGroupName),
            SchemaId = "example-schema",
            ContentType = "application/vnd.ms-azure-apim.xsd+xml",
            Value = File.ReadAllText("api_management_api_schema.xml"),
        });
    }

}
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleApi, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
			Name:              "search-api",
			ApiManagementName: "search-api-management",
			ResourceGroupName: "search-service",
			Revision:          "2",
		}, nil)
		if err != nil {
			return err
		}
		_, err = apimanagement.NewApiSchema(ctx, "exampleApiSchema", &apimanagement.ApiSchemaArgs{
			ApiName:           pulumi.String(exampleApi.Name),
			ApiManagementName: pulumi.String(exampleApi.ApiManagementName),
			ResourceGroupName: pulumi.String(exampleApi.ResourceGroupName),
			SchemaId:          pulumi.String("example-schema"),
			ContentType:       pulumi.String("application/vnd.ms-azure-apim.xsd+xml"),
			Value:             readFileOrPanic("api_management_api_schema.xml"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.apimanagement.ApimanagementFunctions;
import com.pulumi.azure.apimanagement.inputs.GetApiArgs;
import com.pulumi.azure.apimanagement.ApiSchema;
import com.pulumi.azure.apimanagement.ApiSchemaArgs;
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) {
        final var exampleApi = ApimanagementFunctions.getApi(GetApiArgs.builder()
            .name("search-api")
            .apiManagementName("search-api-management")
            .resourceGroupName("search-service")
            .revision("2")
            .build());

        var exampleApiSchema = new ApiSchema("exampleApiSchema", ApiSchemaArgs.builder()        
            .apiName(exampleApi.applyValue(getApiResult -> getApiResult.name()))
            .apiManagementName(exampleApi.applyValue(getApiResult -> getApiResult.apiManagementName()))
            .resourceGroupName(exampleApi.applyValue(getApiResult -> getApiResult.resourceGroupName()))
            .schemaId("example-schema")
            .contentType("application/vnd.ms-azure-apim.xsd+xml")
            .value(Files.readString(Paths.get("api_management_api_schema.xml")))
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_api = azure.apimanagement.get_api(name="search-api",
    api_management_name="search-api-management",
    resource_group_name="search-service",
    revision="2")
example_api_schema = azure.apimanagement.ApiSchema("exampleApiSchema",
    api_name=example_api.name,
    api_management_name=example_api.api_management_name,
    resource_group_name=example_api.resource_group_name,
    schema_id="example-schema",
    content_type="application/vnd.ms-azure-apim.xsd+xml",
    value=(lambda path: open(path).read())("api_management_api_schema.xml"))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as fs from "fs";

const exampleApi = azure.apimanagement.getApi({
    name: "search-api",
    apiManagementName: "search-api-management",
    resourceGroupName: "search-service",
    revision: "2",
});
const exampleApiSchema = new azure.apimanagement.ApiSchema("exampleApiSchema", {
    apiName: exampleApi.then(exampleApi => exampleApi.name),
    apiManagementName: exampleApi.then(exampleApi => exampleApi.apiManagementName),
    resourceGroupName: exampleApi.then(exampleApi => exampleApi.resourceGroupName),
    schemaId: "example-schema",
    contentType: "application/vnd.ms-azure-apim.xsd+xml",
    value: fs.readFileSync("api_management_api_schema.xml"),
});

Coming soon!

Create a ApiSchema Resource

new ApiSchema(name: string, args: ApiSchemaArgs, opts?: CustomResourceOptions);
@overload
def ApiSchema(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              api_management_name: Optional[str] = None,
              api_name: Optional[str] = None,
              content_type: Optional[str] = None,
              resource_group_name: Optional[str] = None,
              schema_id: Optional[str] = None,
              value: Optional[str] = None)
@overload
def ApiSchema(resource_name: str,
              args: ApiSchemaArgs,
              opts: Optional[ResourceOptions] = None)
func NewApiSchema(ctx *Context, name string, args ApiSchemaArgs, opts ...ResourceOption) (*ApiSchema, error)
public ApiSchema(string name, ApiSchemaArgs args, CustomResourceOptions? opts = null)
public ApiSchema(String name, ApiSchemaArgs args)
public ApiSchema(String name, ApiSchemaArgs args, CustomResourceOptions options)
type: azure:apimanagement:ApiSchema
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ApiSchemaArgs
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 ApiSchemaArgs
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 ApiSchemaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ApiSchemaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ApiSchemaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

ApiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

ApiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

ContentType string

The content type of the API Schema.

ResourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

SchemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

Value string

The JSON escaped string defining the document representing the Schema.

ApiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

ApiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

ContentType string

The content type of the API Schema.

ResourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

SchemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

Value string

The JSON escaped string defining the document representing the Schema.

apiManagementName String

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName String

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType String

The content type of the API Schema.

resourceGroupName String

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId String

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value String

The JSON escaped string defining the document representing the Schema.

apiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType string

The content type of the API Schema.

resourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value string

The JSON escaped string defining the document representing the Schema.

api_management_name str

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

api_name str

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

content_type str

The content type of the API Schema.

resource_group_name str

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schema_id str

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value str

The JSON escaped string defining the document representing the Schema.

apiManagementName String

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName String

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType String

The content type of the API Schema.

resourceGroupName String

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId String

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value String

The JSON escaped string defining the document representing the Schema.

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiSchema 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 an Existing ApiSchema Resource

Get an existing ApiSchema 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?: ApiSchemaState, opts?: CustomResourceOptions): ApiSchema
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_management_name: Optional[str] = None,
        api_name: Optional[str] = None,
        content_type: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        schema_id: Optional[str] = None,
        value: Optional[str] = None) -> ApiSchema
func GetApiSchema(ctx *Context, name string, id IDInput, state *ApiSchemaState, opts ...ResourceOption) (*ApiSchema, error)
public static ApiSchema Get(string name, Input<string> id, ApiSchemaState? state, CustomResourceOptions? opts = null)
public static ApiSchema get(String name, Output<String> id, ApiSchemaState 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:
ApiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

ApiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

ContentType string

The content type of the API Schema.

ResourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

SchemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

Value string

The JSON escaped string defining the document representing the Schema.

ApiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

ApiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

ContentType string

The content type of the API Schema.

ResourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

SchemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

Value string

The JSON escaped string defining the document representing the Schema.

apiManagementName String

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName String

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType String

The content type of the API Schema.

resourceGroupName String

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId String

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value String

The JSON escaped string defining the document representing the Schema.

apiManagementName string

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName string

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType string

The content type of the API Schema.

resourceGroupName string

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId string

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value string

The JSON escaped string defining the document representing the Schema.

api_management_name str

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

api_name str

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

content_type str

The content type of the API Schema.

resource_group_name str

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schema_id str

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value str

The JSON escaped string defining the document representing the Schema.

apiManagementName String

The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

apiName String

The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.

contentType String

The content type of the API Schema.

resourceGroupName String

The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

schemaId String

A unique identifier for this API Schema. Changing this forces a new resource to be created.

value String

The JSON escaped string defining the document representing the Schema.

Import

API Management API Schema’s can be imported using the resource id, e.g.

 $ pulumi import azure:apimanagement/apiSchema:ApiSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/schemas/schema1

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.