We recommend using Azure Native.
azure.apimanagement.ApiSchema
Explore with Pulumi AI
Manages an API Schema within an API Management Service.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";
const example = azure.apimanagement.getApi({
name: "search-api",
apiManagementName: "search-api-management",
resourceGroupName: "search-service",
revision: "2",
});
const exampleApiSchema = new azure.apimanagement.ApiSchema("example", {
apiName: example.then(example => example.name),
apiManagementName: example.then(example => example.apiManagementName),
resourceGroupName: example.then(example => example.resourceGroupName),
schemaId: "example-schema",
contentType: "application/vnd.ms-azure-apim.xsd+xml",
value: std.file({
input: "api_management_api_schema.xml",
}).then(invoke => invoke.result),
});
import pulumi
import pulumi_azure as azure
import pulumi_std as std
example = 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("example",
api_name=example.name,
api_management_name=example.api_management_name,
resource_group_name=example.resource_group_name,
schema_id="example-schema",
content_type="application/vnd.ms-azure-apim.xsd+xml",
value=std.file(input="api_management_api_schema.xml").result)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
"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 {
example, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
Name: "search-api",
ApiManagementName: "search-api-management",
ResourceGroupName: "search-service",
Revision: "2",
}, nil)
if err != nil {
return err
}
invokeFile, err := std.File(ctx, &std.FileArgs{
Input: "api_management_api_schema.xml",
}, nil)
if err != nil {
return err
}
_, err = apimanagement.NewApiSchema(ctx, "example", &apimanagement.ApiSchemaArgs{
ApiName: pulumi.String(example.Name),
ApiManagementName: pulumi.String(example.ApiManagementName),
ResourceGroupName: pulumi.String(example.ResourceGroupName),
SchemaId: pulumi.String("example-schema"),
ContentType: pulumi.String("application/vnd.ms-azure-apim.xsd+xml"),
Value: invokeFile.Result,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var example = Azure.ApiManagement.GetApi.Invoke(new()
{
Name = "search-api",
ApiManagementName = "search-api-management",
ResourceGroupName = "search-service",
Revision = "2",
});
var exampleApiSchema = new Azure.ApiManagement.ApiSchema("example", new()
{
ApiName = example.Apply(getApiResult => getApiResult.Name),
ApiManagementName = example.Apply(getApiResult => getApiResult.ApiManagementName),
ResourceGroupName = example.Apply(getApiResult => getApiResult.ResourceGroupName),
SchemaId = "example-schema",
ContentType = "application/vnd.ms-azure-apim.xsd+xml",
Value = Std.File.Invoke(new()
{
Input = "api_management_api_schema.xml",
}).Apply(invoke => invoke.Result),
});
});
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 example = 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(example.applyValue(getApiResult -> getApiResult.name()))
.apiManagementName(example.applyValue(getApiResult -> getApiResult.apiManagementName()))
.resourceGroupName(example.applyValue(getApiResult -> getApiResult.resourceGroupName()))
.schemaId("example-schema")
.contentType("application/vnd.ms-azure-apim.xsd+xml")
.value(StdFunctions.file(FileArgs.builder()
.input("api_management_api_schema.xml")
.build()).result())
.build());
}
}
resources:
exampleApiSchema:
type: azure:apimanagement:ApiSchema
name: example
properties:
apiName: ${example.name}
apiManagementName: ${example.apiManagementName}
resourceGroupName: ${example.resourceGroupName}
schemaId: example-schema
contentType: application/vnd.ms-azure-apim.xsd+xml
value:
fn::invoke:
Function: std:file
Arguments:
input: api_management_api_schema.xml
Return: result
variables:
example:
fn::invoke:
Function: azure:apimanagement:getApi
Arguments:
name: search-api
apiManagementName: search-api-management
resourceGroupName: search-service
revision: '2'
Create ApiSchema Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiSchema(name: string, args: ApiSchemaArgs, opts?: CustomResourceOptions);
@overload
def ApiSchema(resource_name: str,
args: ApiSchemaArgs,
opts: Optional[ResourceOptions] = None)
@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,
components: Optional[str] = None,
definitions: Optional[str] = None,
value: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var apiSchemaResource = new Azure.ApiManagement.ApiSchema("apiSchemaResource", new()
{
ApiManagementName = "string",
ApiName = "string",
ContentType = "string",
ResourceGroupName = "string",
SchemaId = "string",
Components = "string",
Definitions = "string",
Value = "string",
});
example, err := apimanagement.NewApiSchema(ctx, "apiSchemaResource", &apimanagement.ApiSchemaArgs{
ApiManagementName: pulumi.String("string"),
ApiName: pulumi.String("string"),
ContentType: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
SchemaId: pulumi.String("string"),
Components: pulumi.String("string"),
Definitions: pulumi.String("string"),
Value: pulumi.String("string"),
})
var apiSchemaResource = new ApiSchema("apiSchemaResource", ApiSchemaArgs.builder()
.apiManagementName("string")
.apiName("string")
.contentType("string")
.resourceGroupName("string")
.schemaId("string")
.components("string")
.definitions("string")
.value("string")
.build());
api_schema_resource = azure.apimanagement.ApiSchema("apiSchemaResource",
api_management_name="string",
api_name="string",
content_type="string",
resource_group_name="string",
schema_id="string",
components="string",
definitions="string",
value="string")
const apiSchemaResource = new azure.apimanagement.ApiSchema("apiSchemaResource", {
apiManagementName: "string",
apiName: "string",
contentType: "string",
resourceGroupName: "string",
schemaId: "string",
components: "string",
definitions: "string",
value: "string",
});
type: azure:apimanagement:ApiSchema
properties:
apiManagementName: string
apiName: string
components: string
contentType: string
definitions: string
resourceGroupName: string
schemaId: string
value: string
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.