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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.apimanagement.kotlin

import com.pulumi.azure.apimanagement.ApiOperationArgs.builder
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationRequestArgs
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationRequestArgsBuilder
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationResponseArgs
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationResponseArgsBuilder
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationTemplateParameterArgs
import com.pulumi.azure.apimanagement.kotlin.inputs.ApiOperationTemplateParameterArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages an API Operation within an API Management Service.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = azure.apimanagement.getApi({
 *     name: "search-api",
 *     apiManagementName: "search-api-management",
 *     resourceGroupName: "search-service",
 *     revision: "2",
 * });
 * const exampleApiOperation = new azure.apimanagement.ApiOperation("example", {
 *     operationId: "user-delete",
 *     apiName: example.then(example => example.name),
 *     apiManagementName: example.then(example => example.apiManagementName),
 *     resourceGroupName: example.then(example => example.resourceGroupName),
 *     displayName: "Delete User Operation",
 *     method: "DELETE",
 *     urlTemplate: "/users/{id}/delete",
 *     description: "This can only be done by the logged in user.",
 *     templateParameters: [{
 *         name: "id",
 *         type: "number",
 *         required: true,
 *     }],
 *     responses: [{
 *         statusCode: 200,
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.apimanagement.get_api(name="search-api",
 *     api_management_name="search-api-management",
 *     resource_group_name="search-service",
 *     revision="2")
 * example_api_operation = azure.apimanagement.ApiOperation("example",
 *     operation_id="user-delete",
 *     api_name=example.name,
 *     api_management_name=example.api_management_name,
 *     resource_group_name=example.resource_group_name,
 *     display_name="Delete User Operation",
 *     method="DELETE",
 *     url_template="/users/{id}/delete",
 *     description="This can only be done by the logged in user.",
 *     template_parameters=[azure.apimanagement.ApiOperationTemplateParameterArgs(
 *         name="id",
 *         type="number",
 *         required=True,
 *     )],
 *     responses=[azure.apimanagement.ApiOperationResponseArgs(
 *         status_code=200,
 *     )])
 * ```
 * ```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 = "search-api",
 *         ApiManagementName = "search-api-management",
 *         ResourceGroupName = "search-service",
 *         Revision = "2",
 *     });
 *     var exampleApiOperation = new Azure.ApiManagement.ApiOperation("example", new()
 *     {
 *         OperationId = "user-delete",
 *         ApiName = example.Apply(getApiResult => getApiResult.Name),
 *         ApiManagementName = example.Apply(getApiResult => getApiResult.ApiManagementName),
 *         ResourceGroupName = example.Apply(getApiResult => getApiResult.ResourceGroupName),
 *         DisplayName = "Delete User Operation",
 *         Method = "DELETE",
 *         UrlTemplate = "/users/{id}/delete",
 *         Description = "This can only be done by the logged in user.",
 *         TemplateParameters = new[]
 *         {
 *             new Azure.ApiManagement.Inputs.ApiOperationTemplateParameterArgs
 *             {
 *                 Name = "id",
 *                 Type = "number",
 *                 Required = true,
 *             },
 *         },
 *         Responses = new[]
 *         {
 *             new Azure.ApiManagement.Inputs.ApiOperationResponseArgs
 *             {
 *                 StatusCode = 200,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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:              "search-api",
 * 			ApiManagementName: "search-api-management",
 * 			ResourceGroupName: "search-service",
 * 			Revision:          "2",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apimanagement.NewApiOperation(ctx, "example", &apimanagement.ApiOperationArgs{
 * 			OperationId:       pulumi.String("user-delete"),
 * 			ApiName:           pulumi.String(example.Name),
 * 			ApiManagementName: pulumi.String(example.ApiManagementName),
 * 			ResourceGroupName: pulumi.String(example.ResourceGroupName),
 * 			DisplayName:       pulumi.String("Delete User Operation"),
 * 			Method:            pulumi.String("DELETE"),
 * 			UrlTemplate:       pulumi.String("/users/{id}/delete"),
 * 			Description:       pulumi.String("This can only be done by the logged in user."),
 * 			TemplateParameters: apimanagement.ApiOperationTemplateParameterArray{
 * 				&apimanagement.ApiOperationTemplateParameterArgs{
 * 					Name:     pulumi.String("id"),
 * 					Type:     pulumi.String("number"),
 * 					Required: pulumi.Bool(true),
 * 				},
 * 			},
 * 			Responses: apimanagement.ApiOperationResponseArray{
 * 				&apimanagement.ApiOperationResponseArgs{
 * 					StatusCode: pulumi.Int(200),
 * 				},
 * 			},
 * 		})
 * 		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.ApiOperation;
 * import com.pulumi.azure.apimanagement.ApiOperationArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiOperationTemplateParameterArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiOperationResponseArgs;
 * 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 exampleApiOperation = new ApiOperation("exampleApiOperation", ApiOperationArgs.builder()
 *             .operationId("user-delete")
 *             .apiName(example.applyValue(getApiResult -> getApiResult.name()))
 *             .apiManagementName(example.applyValue(getApiResult -> getApiResult.apiManagementName()))
 *             .resourceGroupName(example.applyValue(getApiResult -> getApiResult.resourceGroupName()))
 *             .displayName("Delete User Operation")
 *             .method("DELETE")
 *             .urlTemplate("/users/{id}/delete")
 *             .description("This can only be done by the logged in user.")
 *             .templateParameters(ApiOperationTemplateParameterArgs.builder()
 *                 .name("id")
 *                 .type("number")
 *                 .required(true)
 *                 .build())
 *             .responses(ApiOperationResponseArgs.builder()
 *                 .statusCode(200)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleApiOperation:
 *     type: azure:apimanagement:ApiOperation
 *     name: example
 *     properties:
 *       operationId: user-delete
 *       apiName: ${example.name}
 *       apiManagementName: ${example.apiManagementName}
 *       resourceGroupName: ${example.resourceGroupName}
 *       displayName: Delete User Operation
 *       method: DELETE
 *       urlTemplate: /users/{id}/delete
 *       description: This can only be done by the logged in user.
 *       templateParameters:
 *         - name: id
 *           type: number
 *           required: true
 *       responses:
 *         - statusCode: 200
 * 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 Operation's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:apimanagement/apiOperation:ApiOperation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/operations/operation1
 * ```
 * @property apiManagementName The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
 * @property apiName The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
 * @property description A description for this API Operation, which may include HTML formatting tags.
 * @property displayName The Display Name for this API Management Operation.
 * @property method The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
 * @property operationId A unique identifier for this API Operation. Changing this forces a new resource to be created.
 * @property request A `request` block as defined below.
 * @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 responses One or more `response` blocks as defined below.
 * @property templateParameters One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
 * @property urlTemplate The relative URL Template identifying the target resource for this operation, which may include parameters.
 */
public data class ApiOperationArgs(
    public val apiManagementName: Output? = null,
    public val apiName: Output? = null,
    public val description: Output? = null,
    public val displayName: Output? = null,
    public val method: Output? = null,
    public val operationId: Output? = null,
    public val request: Output? = null,
    public val resourceGroupName: Output? = null,
    public val responses: Output>? = null,
    public val templateParameters: Output>? = null,
    public val urlTemplate: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.apimanagement.ApiOperationArgs =
        com.pulumi.azure.apimanagement.ApiOperationArgs.builder()
            .apiManagementName(apiManagementName?.applyValue({ args0 -> args0 }))
            .apiName(apiName?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .method(method?.applyValue({ args0 -> args0 }))
            .operationId(operationId?.applyValue({ args0 -> args0 }))
            .request(request?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .responses(
                responses?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .templateParameters(
                templateParameters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .urlTemplate(urlTemplate?.applyValue({ args0 -> args0 })).build()
}

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

    private var apiName: Output? = null

    private var description: Output? = null

    private var displayName: Output? = null

    private var method: Output? = null

    private var operationId: Output? = null

    private var request: Output? = null

    private var resourceGroupName: Output? = null

    private var responses: Output>? = null

    private var templateParameters: Output>? = null

    private var urlTemplate: Output? = null

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

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

    /**
     * @param value A description for this API Operation, which may include HTML formatting tags.
     */
    @JvmName("apwiyrjbyxtlhryh")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value The Display Name for this API Management Operation.
     */
    @JvmName("aueqiilcknoyvrxt")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
     */
    @JvmName("attkikqbnltmhbcn")
    public suspend fun method(`value`: Output) {
        this.method = value
    }

    /**
     * @param value A unique identifier for this API Operation. Changing this forces a new resource to be created.
     */
    @JvmName("fnlslsgvgbaawuup")
    public suspend fun operationId(`value`: Output) {
        this.operationId = value
    }

    /**
     * @param value A `request` block as defined below.
     */
    @JvmName("rnppopbywrxygdfq")
    public suspend fun request(`value`: Output) {
        this.request = 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("ueludhwlietffogj")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value One or more `response` blocks as defined below.
     */
    @JvmName("lpitpuvgfdfboqhw")
    public suspend fun responses(`value`: Output>) {
        this.responses = value
    }

    @JvmName("mhoxqsdalkjavdbi")
    public suspend fun responses(vararg values: Output) {
        this.responses = Output.all(values.asList())
    }

    /**
     * @param values One or more `response` blocks as defined below.
     */
    @JvmName("hoobxcyvirewufqk")
    public suspend fun responses(values: List>) {
        this.responses = Output.all(values)
    }

    /**
     * @param value One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("plrovoofsfxhlful")
    public suspend fun templateParameters(`value`: Output>) {
        this.templateParameters = value
    }

    @JvmName("nkrthxfxbjwyebuu")
    public suspend fun templateParameters(vararg values: Output) {
        this.templateParameters = Output.all(values.asList())
    }

    /**
     * @param values One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("nwkwpicvwbfocfix")
    public suspend fun templateParameters(values: List>) {
        this.templateParameters = Output.all(values)
    }

    /**
     * @param value The relative URL Template identifying the target resource for this operation, which may include parameters.
     */
    @JvmName("ehnnxewfrpkgcpgc")
    public suspend fun urlTemplate(`value`: Output) {
        this.urlTemplate = value
    }

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

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

    /**
     * @param value A description for this API Operation, which may include HTML formatting tags.
     */
    @JvmName("ewiowtsyaaklqcbt")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value The Display Name for this API Management Operation.
     */
    @JvmName("qsrqeblyorfkqaib")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
     */
    @JvmName("xcpiqoqlxcukdvpk")
    public suspend fun method(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.method = mapped
    }

    /**
     * @param value A unique identifier for this API Operation. Changing this forces a new resource to be created.
     */
    @JvmName("gbihguyvrxtwbmdo")
    public suspend fun operationId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.operationId = mapped
    }

    /**
     * @param value A `request` block as defined below.
     */
    @JvmName("ktujynaldrgssqco")
    public suspend fun request(`value`: ApiOperationRequestArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.request = mapped
    }

    /**
     * @param argument A `request` block as defined below.
     */
    @JvmName("sanghknagckindhe")
    public suspend fun request(argument: suspend ApiOperationRequestArgsBuilder.() -> Unit) {
        val toBeMapped = ApiOperationRequestArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.request = 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("dpdtvmlrulhehwrh")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value One or more `response` blocks as defined below.
     */
    @JvmName("fbuqamhteoxsrayg")
    public suspend fun responses(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.responses = mapped
    }

    /**
     * @param argument One or more `response` blocks as defined below.
     */
    @JvmName("yagwoeitlsmtivdr")
    public suspend fun responses(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ApiOperationResponseArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param argument One or more `response` blocks as defined below.
     */
    @JvmName("sbhywaogwesfiark")
    public suspend fun responses(
        vararg
        argument: suspend ApiOperationResponseArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            ApiOperationResponseArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param argument One or more `response` blocks as defined below.
     */
    @JvmName("xbqiycnlutfpvhgs")
    public suspend fun responses(argument: suspend ApiOperationResponseArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ApiOperationResponseArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param values One or more `response` blocks as defined below.
     */
    @JvmName("kkextxntonrmgwkf")
    public suspend fun responses(vararg values: ApiOperationResponseArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.responses = mapped
    }

    /**
     * @param value One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("qlqlvccdngmlkoib")
    public suspend fun templateParameters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.templateParameters = mapped
    }

    /**
     * @param argument One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("xensyxuatpvwpqhu")
    public suspend
    fun templateParameters(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ApiOperationTemplateParameterArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param argument One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("hunrymflxpsqqulg")
    public suspend fun templateParameters(
        vararg
        argument: suspend ApiOperationTemplateParameterArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            ApiOperationTemplateParameterArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param argument One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("knfrpapblqiochaa")
    public suspend
    fun templateParameters(argument: suspend ApiOperationTemplateParameterArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            ApiOperationTemplateParameterArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param values One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
     */
    @JvmName("qnhrqslmdssbglww")
    public suspend fun templateParameters(vararg values: ApiOperationTemplateParameterArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.templateParameters = mapped
    }

    /**
     * @param value The relative URL Template identifying the target resource for this operation, which may include parameters.
     */
    @JvmName("pmklpmqmmqcbrbyt")
    public suspend fun urlTemplate(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.urlTemplate = mapped
    }

    internal fun build(): ApiOperationArgs = ApiOperationArgs(
        apiManagementName = apiManagementName,
        apiName = apiName,
        description = description,
        displayName = displayName,
        method = method,
        operationId = operationId,
        request = request,
        resourceGroupName = resourceGroupName,
        responses = responses,
        templateParameters = templateParameters,
        urlTemplate = urlTemplate,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy