All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.apimanagement.kotlin.ApiPolicyArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.apimanagement.kotlin

import com.pulumi.azure.apimanagement.ApiPolicyArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Manages an API Management API Policy
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = azure.apimanagement.getApi({
 *     name: "my-api",
 *     apiManagementName: "example-apim",
 *     resourceGroupName: "search-service",
 *     revision: "2",
 * });
 * const exampleApiPolicy = new azure.apimanagement.ApiPolicy("example", {
 *     apiName: example.then(example => example.name),
 *     apiManagementName: example.then(example => example.apiManagementName),
 *     resourceGroupName: example.then(example => example.resourceGroupName),
 *     xmlContent: `
 *   
 *     
 *   
 * 
 * `,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.apimanagement.get_api(name="my-api",
 *     api_management_name="example-apim",
 *     resource_group_name="search-service",
 *     revision="2")
 * example_api_policy = azure.apimanagement.ApiPolicy("example",
 *     api_name=example.name,
 *     api_management_name=example.api_management_name,
 *     resource_group_name=example.resource_group_name,
 *     xml_content="""
 *   
 *     
 *   
 * 
 * """)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Azure.ApiManagement.GetApi.Invoke(new()
 *     {
 *         Name = "my-api",
 *         ApiManagementName = "example-apim",
 *         ResourceGroupName = "search-service",
 *         Revision = "2",
 *     });
 *     var exampleApiPolicy = new Azure.ApiManagement.ApiPolicy("example", new()
 *     {
 *         ApiName = example.Apply(getApiResult => getApiResult.Name),
 *         ApiManagementName = example.Apply(getApiResult => getApiResult.ApiManagementName),
 *         ResourceGroupName = example.Apply(getApiResult => getApiResult.ResourceGroupName),
 *         XmlContent = @"
 *   
 *     
 *   
 * 
 * ",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
 * 	"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:              "my-api",
 * 			ApiManagementName: "example-apim",
 * 			ResourceGroupName: "search-service",
 * 			Revision:          "2",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apimanagement.NewApiPolicy(ctx, "example", &apimanagement.ApiPolicyArgs{
 * 			ApiName:           pulumi.String(example.Name),
 * 			ApiManagementName: pulumi.String(example.ApiManagementName),
 * 			ResourceGroupName: pulumi.String(example.ResourceGroupName),
 * 			XmlContent: pulumi.String(`
 *   
 *     
 *   
 * 
 * `),
 * 		})
 * 		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.ApiPolicy;
 * import com.pulumi.azure.apimanagement.ApiPolicyArgs;
 * 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("my-api")
 *             .apiManagementName("example-apim")
 *             .resourceGroupName("search-service")
 *             .revision("2")
 *             .build());
 *         var exampleApiPolicy = new ApiPolicy("exampleApiPolicy", ApiPolicyArgs.builder()
 *             .apiName(example.applyValue(getApiResult -> getApiResult.name()))
 *             .apiManagementName(example.applyValue(getApiResult -> getApiResult.apiManagementName()))
 *             .resourceGroupName(example.applyValue(getApiResult -> getApiResult.resourceGroupName()))
 *             .xmlContent("""
 * 
 *   
 *     
 *   
 * 
 *             """)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleApiPolicy:
 *     type: azure:apimanagement:ApiPolicy
 *     name: example
 *     properties:
 *       apiName: ${example.name}
 *       apiManagementName: ${example.apiManagementName}
 *       resourceGroupName: ${example.resourceGroupName}
 *       xmlContent: |
 *         
 *           
 *             
 *           
 *         
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:apimanagement:getApi
 *       Arguments:
 *         name: my-api
 *         apiManagementName: example-apim
 *         resourceGroupName: search-service
 *         revision: '2'
 * ```
 * 
 * ## Import
 * API Management API Policy can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:apimanagement/apiPolicy:ApiPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId
 * ```
 * @property apiManagementName The name of the API Management Service. Changing this forces a new resource to be created.
 * @property apiName The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
 * @property xmlContent The XML Content for this Policy as a string.
 * @property xmlLink A link to a Policy XML Document, which must be publicly available.
 */
public data class ApiPolicyArgs(
    public val apiManagementName: Output? = null,
    public val apiName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val xmlContent: Output? = null,
    public val xmlLink: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.apimanagement.ApiPolicyArgs =
        com.pulumi.azure.apimanagement.ApiPolicyArgs.builder()
            .apiManagementName(apiManagementName?.applyValue({ args0 -> args0 }))
            .apiName(apiName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .xmlContent(xmlContent?.applyValue({ args0 -> args0 }))
            .xmlLink(xmlLink?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ApiPolicyArgs].
 */
@PulumiTagMarker
public class ApiPolicyArgsBuilder internal constructor() {
    private var apiManagementName: Output? = null

    private var apiName: Output? = null

    private var resourceGroupName: Output? = null

    private var xmlContent: Output? = null

    private var xmlLink: Output? = null

    /**
     * @param value The name of the API Management Service. Changing this forces a new resource to be created.
     */
    @JvmName("oihjbxwnmiscctbv")
    public suspend fun apiManagementName(`value`: Output) {
        this.apiManagementName = value
    }

    /**
     * @param value The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
     */
    @JvmName("xvlcakrwykuwpmvo")
    public suspend fun apiName(`value`: Output) {
        this.apiName = value
    }

    /**
     * @param value The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
     */
    @JvmName("amodyxuujdebsuvc")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The XML Content for this Policy as a string.
     */
    @JvmName("tnfmsajqktlweqyt")
    public suspend fun xmlContent(`value`: Output) {
        this.xmlContent = value
    }

    /**
     * @param value A link to a Policy XML Document, which must be publicly available.
     */
    @JvmName("bcagmgevmmyimwpb")
    public suspend fun xmlLink(`value`: Output) {
        this.xmlLink = value
    }

    /**
     * @param value The name of the API Management Service. Changing this forces a new resource to be created.
     */
    @JvmName("rqqhbsgigwejlske")
    public suspend fun apiManagementName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.apiManagementName = mapped
    }

    /**
     * @param value The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
     */
    @JvmName("vflxmgpivuftcdoi")
    public suspend fun apiName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.apiName = mapped
    }

    /**
     * @param value The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
     */
    @JvmName("pidptuvhmbwbqjhg")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value The XML Content for this Policy as a string.
     */
    @JvmName("ncnbydtfncoeoyhs")
    public suspend fun xmlContent(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.xmlContent = mapped
    }

    /**
     * @param value A link to a Policy XML Document, which must be publicly available.
     */
    @JvmName("imswuwajqxnoacni")
    public suspend fun xmlLink(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.xmlLink = mapped
    }

    internal fun build(): ApiPolicyArgs = ApiPolicyArgs(
        apiManagementName = apiManagementName,
        apiName = apiName,
        resourceGroupName = resourceGroupName,
        xmlContent = xmlContent,
        xmlLink = xmlLink,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy