
com.pulumi.azure.apimanagement.kotlin.ApiSchema.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 [ApiSchema].
*/
@PulumiTagMarker
public class ApiSchemaResourceBuilder internal constructor() {
public var name: String? = null
public var args: ApiSchemaArgs = ApiSchemaArgs()
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 ApiSchemaArgsBuilder.() -> Unit) {
val builder = ApiSchemaArgsBuilder()
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(): ApiSchema {
val builtJavaResource = com.pulumi.azure.apimanagement.ApiSchema(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ApiSchema(builtJavaResource)
}
}
/**
* Manages an API 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 = 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),
* });
* ```
* ```python
* 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)
* ```
* ```csharp
* 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),
* });
* });
* ```
* ```go
* 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: pulumi.String(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.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());
* }
* }
* ```
* ```yaml
* 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'
* ```
*
* ## Import
* API Management API Schema's can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:apimanagement/apiSchema:ApiSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/schemas/schema1
* ```
*/
public class ApiSchema internal constructor(
override val javaResource: com.pulumi.azure.apimanagement.ApiSchema,
) : KotlinCustomResource(javaResource, ApiSchemaMapper) {
/**
* 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 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.
*/
public val apiName: Output
get() = javaResource.apiName().applyValue({ args0 -> args0 })
/**
* Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.
*/
public val components: Output?
get() = javaResource.components().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The content type of the API Schema.
*/
public val contentType: Output
get() = javaResource.contentType().applyValue({ args0 -> args0 })
/**
* Types definitions. Used for Swagger/OpenAPI v1 schemas only.
*/
public val definitions: Output?
get() = javaResource.definitions().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 API Schema. Changing this forces a new resource to be created.
*/
public val schemaId: Output
get() = javaResource.schemaId().applyValue({ args0 -> args0 })
/**
* The JSON escaped string defining the document representing the Schema.
*/
public val `value`: Output?
get() = javaResource.`value`().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object ApiSchemaMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.apimanagement.ApiSchema::class == javaResource::class
override fun map(javaResource: Resource): ApiSchema = ApiSchema(
javaResource as
com.pulumi.azure.apimanagement.ApiSchema,
)
}
/**
* @see [ApiSchema].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ApiSchema].
*/
public suspend fun apiSchema(name: String, block: suspend ApiSchemaResourceBuilder.() -> Unit): ApiSchema {
val builder = ApiSchemaResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ApiSchema].
* @param name The _unique_ name of the resulting resource.
*/
public fun apiSchema(name: String): ApiSchema {
val builder = ApiSchemaResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy