com.pulumi.azure.apimanagement.kotlin.GlobalSchema.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.apimanagement.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [GlobalSchema].
*/
@PulumiTagMarker
public class GlobalSchemaResourceBuilder internal constructor() {
public var name: String? = null
public var args: GlobalSchemaArgs = GlobalSchemaArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend GlobalSchemaArgsBuilder.() -> Unit) {
val builder = GlobalSchemaArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): GlobalSchema {
val builtJavaResource = com.pulumi.azure.apimanagement.GlobalSchema(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GlobalSchema(builtJavaResource)
}
}
/**
* Manages a Global Schema within an API Management Service.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* import * as std from "@pulumi/std";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-rg",
* location: "West Europe",
* });
* const exampleService = new azure.apimanagement.Service("example", {
* name: "example-apim",
* location: example.location,
* resourceGroupName: example.name,
* publisherName: "pub1",
* publisherEmail: "[email protected]",
* skuName: "Consumption_0",
* });
* const exampleGlobalSchema = new azure.apimanagement.GlobalSchema("example", {
* schemaId: "example-schema1",
* apiManagementName: exampleService.name,
* resourceGroupName: example.name,
* type: "xml",
* value: std.file({
* input: "api_management_api_schema.xml",
* }).then(invoke => invoke.result),
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* import pulumi_std as std
* example = azure.core.ResourceGroup("example",
* name="example-rg",
* location="West Europe")
* example_service = azure.apimanagement.Service("example",
* name="example-apim",
* location=example.location,
* resource_group_name=example.name,
* publisher_name="pub1",
* publisher_email="[email protected]",
* sku_name="Consumption_0")
* example_global_schema = azure.apimanagement.GlobalSchema("example",
* schema_id="example-schema1",
* api_management_name=example_service.name,
* resource_group_name=example.name,
* type="xml",
* value=std.file(input="api_management_api_schema.xml").result)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-rg",
* Location = "West Europe",
* });
* var exampleService = new Azure.ApiManagement.Service("example", new()
* {
* Name = "example-apim",
* Location = example.Location,
* ResourceGroupName = example.Name,
* PublisherName = "pub1",
* PublisherEmail = "[email protected]",
* SkuName = "Consumption_0",
* });
* var exampleGlobalSchema = new Azure.ApiManagement.GlobalSchema("example", new()
* {
* SchemaId = "example-schema1",
* ApiManagementName = exampleService.Name,
* ResourceGroupName = example.Name,
* Type = "xml",
* Value = Std.File.Invoke(new()
* {
* Input = "api_management_api_schema.xml",
* }).Apply(invoke => invoke.Result),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "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 := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-rg"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleService, err := apimanagement.NewService(ctx, "example", &apimanagement.ServiceArgs{
* Name: pulumi.String("example-apim"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* PublisherName: pulumi.String("pub1"),
* PublisherEmail: pulumi.String("[email protected]"),
* SkuName: pulumi.String("Consumption_0"),
* })
* 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.NewGlobalSchema(ctx, "example", &apimanagement.GlobalSchemaArgs{
* SchemaId: pulumi.String("example-schema1"),
* ApiManagementName: exampleService.Name,
* ResourceGroupName: example.Name,
* Type: pulumi.String("xml"),
* Value: invokeFile.Result,
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-rg")
* .location("West Europe")
* .build());
* var exampleService = new Service("exampleService", ServiceArgs.builder()
* .name("example-apim")
* .location(example.location())
* .resourceGroupName(example.name())
* .publisherName("pub1")
* .publisherEmail("[email protected]")
* .skuName("Consumption_0")
* .build());
* var exampleGlobalSchema = new GlobalSchema("exampleGlobalSchema", GlobalSchemaArgs.builder()
* .schemaId("example-schema1")
* .apiManagementName(exampleService.name())
* .resourceGroupName(example.name())
* .type("xml")
* .value(StdFunctions.file(FileArgs.builder()
* .input("api_management_api_schema.xml")
* .build()).result())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-rg
* location: West Europe
* exampleService:
* type: azure:apimanagement:Service
* name: example
* properties:
* name: example-apim
* location: ${example.location}
* resourceGroupName: ${example.name}
* publisherName: pub1
* publisherEmail: [email protected]
* skuName: Consumption_0
* exampleGlobalSchema:
* type: azure:apimanagement:GlobalSchema
* name: example
* properties:
* schemaId: example-schema1
* apiManagementName: ${exampleService.name}
* resourceGroupName: ${example.name}
* type: xml
* value:
* fn::invoke:
* Function: std:file
* Arguments:
* input: api_management_api_schema.xml
* Return: result
* ```
*
* ## Import
* API Management API Schema's can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:apimanagement/globalSchema:GlobalSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/schemas/schema1
* ```
*/
public class GlobalSchema internal constructor(
override val javaResource: com.pulumi.azure.apimanagement.GlobalSchema,
) : KotlinCustomResource(javaResource, GlobalSchemaMapper) {
/**
* The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
*/
public val apiManagementName: Output
get() = javaResource.apiManagementName().applyValue({ args0 -> args0 })
/**
* The description of the schema.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* A unique identifier for this Schema. Changing this forces a new resource to be created.
*/
public val schemaId: Output
get() = javaResource.schemaId().applyValue({ args0 -> args0 })
/**
* The content type of the Schema. Possible values are `xml` and `json`.
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* The string defining the document representing the Schema.
*/
public val `value`: Output
get() = javaResource.`value`().applyValue({ args0 -> args0 })
}
public object GlobalSchemaMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.apimanagement.GlobalSchema::class == javaResource::class
override fun map(javaResource: Resource): GlobalSchema = GlobalSchema(
javaResource as
com.pulumi.azure.apimanagement.GlobalSchema,
)
}
/**
* @see [GlobalSchema].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GlobalSchema].
*/
public suspend fun globalSchema(
name: String,
block: suspend GlobalSchemaResourceBuilder.() -> Unit,
): GlobalSchema {
val builder = GlobalSchemaResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GlobalSchema].
* @param name The _unique_ name of the resulting resource.
*/
public fun globalSchema(name: String): GlobalSchema {
val builder = GlobalSchemaResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy