We recommend using Azure Native.
azure.apimanagement.ApiSchema
Explore with Pulumi AI
Manages an API Schema within an API Management Service.
Example Usage
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleApi = Azure.ApiManagement.GetApi.Invoke(new()
{
Name = "search-api",
ApiManagementName = "search-api-management",
ResourceGroupName = "search-service",
Revision = "2",
});
var exampleApiSchema = new Azure.ApiManagement.ApiSchema("exampleApiSchema", new()
{
ApiName = exampleApi.Apply(getApiResult => getApiResult.Name),
ApiManagementName = exampleApi.Apply(getApiResult => getApiResult.ApiManagementName),
ResourceGroupName = exampleApi.Apply(getApiResult => getApiResult.ResourceGroupName),
SchemaId = "example-schema",
ContentType = "application/vnd.ms-azure-apim.xsd+xml",
Value = File.ReadAllText("api_management_api_schema.xml"),
});
});
package main
import (
"os"
"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 := os.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"),
});
resources:
exampleApiSchema:
type: azure:apimanagement:ApiSchema
properties:
apiName: ${exampleApi.name}
apiManagementName: ${exampleApi.apiManagementName}
resourceGroupName: ${exampleApi.resourceGroupName}
schemaId: example-schema
contentType: application/vnd.ms-azure-apim.xsd+xml
value:
fn::readFile: api_management_api_schema.xml
variables:
exampleApi:
fn::invoke:
Function: azure:apimanagement:getApi
Arguments:
name: search-api
apiManagementName: search-api-management
resourceGroupName: search-service
revision: '2'
Create 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,
components: Optional[str] = None,
content_type: Optional[str] = None,
definitions: 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:
- Api
Management stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name 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.
- Content
Type string The content type of the API Schema.
- Resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- Definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- Value string
The JSON escaped string defining the document representing the Schema.
- Api
Management stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name 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.
- Content
Type string The content type of the API Schema.
- Resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- Definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- Value string
The JSON escaped string defining the document representing the Schema.
- api
Management StringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- content
Type String The content type of the API Schema.
- resource
Group StringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String A unique identifier for this API Schema. Changing this forces a new resource to be created.
- components String
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- definitions String
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- value String
The JSON escaped string defining the document representing the Schema.
- api
Management stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- content
Type string The content type of the API Schema.
- resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id string A unique identifier for this API Schema. Changing this forces a new resource to be created.
- components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- value string
The JSON escaped string defining the document representing the Schema.
- api_
management_ strname 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_ strname 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.
- components str
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- definitions str
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- value str
The JSON escaped string defining the document representing the Schema.
- api
Management StringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- content
Type String The content type of the API Schema.
- resource
Group StringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String A unique identifier for this API Schema. Changing this forces a new resource to be created.
- components String
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- definitions String
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- 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 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,
components: Optional[str] = None,
content_type: Optional[str] = None,
definitions: 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.
- Api
Management stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name 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.
- Components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- Content
Type string The content type of the API Schema.
- Definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- Resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id 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 stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name 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.
- Components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- Content
Type string The content type of the API Schema.
- Definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- Resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id 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 StringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- components String
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- content
Type String The content type of the API Schema.
- definitions String
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- resource
Group StringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id 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 stringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- components string
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- content
Type string The content type of the API Schema.
- definitions string
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- resource
Group stringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id 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_ strname 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.
- components str
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- content_
type str The content type of the API Schema.
- definitions str
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- resource_
group_ strname 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.
- api
Management StringName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name 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.
- components String
Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
- content
Type String The content type of the API Schema.
- definitions String
Types definitions. Used for Swagger/OpenAPI v1 schemas only.
- resource
Group StringName The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id 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
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.