We recommend using Azure Native.
azure.apimanagement.GlobalSchema
Explore with Pulumi AI
Manages a Global 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 exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var exampleService = new Azure.ApiManagement.Service("exampleService", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
PublisherName = "pub1",
PublisherEmail = "pub1@email.com",
SkuName = "Consumption_0",
});
var exampleGlobalSchema = new Azure.ApiManagement.GlobalSchema("exampleGlobalSchema", new()
{
SchemaId = "example-schema1",
ApiManagementName = exampleService.Name,
ResourceGroupName = exampleResourceGroup.Name,
Type = "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-azure/sdk/v5/go/azure/core"
"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 {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleService, err := apimanagement.NewService(ctx, "exampleService", &apimanagement.ServiceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
PublisherName: pulumi.String("pub1"),
PublisherEmail: pulumi.String("pub1@email.com"),
SkuName: pulumi.String("Consumption_0"),
})
if err != nil {
return err
}
_, err = apimanagement.NewGlobalSchema(ctx, "exampleGlobalSchema", &apimanagement.GlobalSchemaArgs{
SchemaId: pulumi.String("example-schema1"),
ApiManagementName: exampleService.Name,
ResourceGroupName: exampleResourceGroup.Name,
Type: pulumi.String("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.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.apimanagement.Service;
import com.pulumi.azure.apimanagement.ServiceArgs;
import com.pulumi.azure.apimanagement.GlobalSchema;
import com.pulumi.azure.apimanagement.GlobalSchemaArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleService = new Service("exampleService", ServiceArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.publisherName("pub1")
.publisherEmail("pub1@email.com")
.skuName("Consumption_0")
.build());
var exampleGlobalSchema = new GlobalSchema("exampleGlobalSchema", GlobalSchemaArgs.builder()
.schemaId("example-schema1")
.apiManagementName(exampleService.name())
.resourceGroupName(exampleResourceGroup.name())
.type("xml")
.value(Files.readString(Paths.get("api_management_api_schema.xml")))
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_service = azure.apimanagement.Service("exampleService",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
publisher_name="pub1",
publisher_email="pub1@email.com",
sku_name="Consumption_0")
example_global_schema = azure.apimanagement.GlobalSchema("exampleGlobalSchema",
schema_id="example-schema1",
api_management_name=example_service.name,
resource_group_name=example_resource_group.name,
type="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 exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleService = new azure.apimanagement.Service("exampleService", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
publisherName: "pub1",
publisherEmail: "pub1@email.com",
skuName: "Consumption_0",
});
const exampleGlobalSchema = new azure.apimanagement.GlobalSchema("exampleGlobalSchema", {
schemaId: "example-schema1",
apiManagementName: exampleService.name,
resourceGroupName: exampleResourceGroup.name,
type: "xml",
value: fs.readFileSync("api_management_api_schema.xml"),
});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleService:
type: azure:apimanagement:Service
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
publisherName: pub1
publisherEmail: pub1@email.com
skuName: Consumption_0
exampleGlobalSchema:
type: azure:apimanagement:GlobalSchema
properties:
schemaId: example-schema1
apiManagementName: ${exampleService.name}
resourceGroupName: ${exampleResourceGroup.name}
type: xml
value:
fn::readFile: api_management_api_schema.xml
Create GlobalSchema Resource
new GlobalSchema(name: string, args: GlobalSchemaArgs, opts?: CustomResourceOptions);
@overload
def GlobalSchema(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_management_name: Optional[str] = None,
description: Optional[str] = None,
resource_group_name: Optional[str] = None,
schema_id: Optional[str] = None,
type: Optional[str] = None,
value: Optional[str] = None)
@overload
def GlobalSchema(resource_name: str,
args: GlobalSchemaArgs,
opts: Optional[ResourceOptions] = None)
func NewGlobalSchema(ctx *Context, name string, args GlobalSchemaArgs, opts ...ResourceOption) (*GlobalSchema, error)
public GlobalSchema(string name, GlobalSchemaArgs args, CustomResourceOptions? opts = null)
public GlobalSchema(String name, GlobalSchemaArgs args)
public GlobalSchema(String name, GlobalSchemaArgs args, CustomResourceOptions options)
type: azure:apimanagement:GlobalSchema
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GlobalSchemaArgs
- 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 GlobalSchemaArgs
- 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 GlobalSchemaArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GlobalSchemaArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GlobalSchemaArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
GlobalSchema 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 GlobalSchema 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.
- 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 Schema. Changing this forces a new resource to be created.
- Type string
The content type of the Schema. Possible values are
xml
andjson
.- Value string
The string defining the document representing the Schema.
- Description string
The description of 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.
- 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 Schema. Changing this forces a new resource to be created.
- Type string
The content type of the Schema. Possible values are
xml
andjson
.- Value string
The string defining the document representing the Schema.
- Description string
The description of 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.
- 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 Schema. Changing this forces a new resource to be created.
- type String
The content type of the Schema. Possible values are
xml
andjson
.- value String
The string defining the document representing the Schema.
- description String
The description of 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.
- 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 Schema. Changing this forces a new resource to be created.
- type string
The content type of the Schema. Possible values are
xml
andjson
.- value string
The string defining the document representing the Schema.
- description string
The description of 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.
- 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 Schema. Changing this forces a new resource to be created.
- type str
The content type of the Schema. Possible values are
xml
andjson
.- value str
The string defining the document representing the Schema.
- description str
The description of 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.
- 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 Schema. Changing this forces a new resource to be created.
- type String
The content type of the Schema. Possible values are
xml
andjson
.- value String
The string defining the document representing the Schema.
- description String
The description of the schema.
Outputs
All input properties are implicitly available as output properties. Additionally, the GlobalSchema 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 GlobalSchema Resource
Get an existing GlobalSchema 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?: GlobalSchemaState, opts?: CustomResourceOptions): GlobalSchema
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_management_name: Optional[str] = None,
description: Optional[str] = None,
resource_group_name: Optional[str] = None,
schema_id: Optional[str] = None,
type: Optional[str] = None,
value: Optional[str] = None) -> GlobalSchema
func GetGlobalSchema(ctx *Context, name string, id IDInput, state *GlobalSchemaState, opts ...ResourceOption) (*GlobalSchema, error)
public static GlobalSchema Get(string name, Input<string> id, GlobalSchemaState? state, CustomResourceOptions? opts = null)
public static GlobalSchema get(String name, Output<String> id, GlobalSchemaState 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.
- Description string
The description of the 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 Schema. Changing this forces a new resource to be created.
- Type string
The content type of the Schema. Possible values are
xml
andjson
.- Value string
The 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.
- Description string
The description of the 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 Schema. Changing this forces a new resource to be created.
- Type string
The content type of the Schema. Possible values are
xml
andjson
.- Value string
The 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.
- description String
The description of the 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 Schema. Changing this forces a new resource to be created.
- type String
The content type of the Schema. Possible values are
xml
andjson
.- value String
The 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.
- description string
The description of the 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 Schema. Changing this forces a new resource to be created.
- type string
The content type of the Schema. Possible values are
xml
andjson
.- value string
The 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.
- description str
The description of the 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 Schema. Changing this forces a new resource to be created.
- type str
The content type of the Schema. Possible values are
xml
andjson
.- value str
The 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.
- description String
The description of the 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 Schema. Changing this forces a new resource to be created.
- type String
The content type of the Schema. Possible values are
xml
andjson
.- value String
The 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/globalSchema:GlobalSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/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.