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

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

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

package com.pulumi.azurenative.apimanagement.kotlin

import com.pulumi.azurenative.apimanagement.ApiOperationArgs.builder
import com.pulumi.azurenative.apimanagement.kotlin.inputs.ParameterContractArgs
import com.pulumi.azurenative.apimanagement.kotlin.inputs.ParameterContractArgsBuilder
import com.pulumi.azurenative.apimanagement.kotlin.inputs.RequestContractArgs
import com.pulumi.azurenative.apimanagement.kotlin.inputs.RequestContractArgsBuilder
import com.pulumi.azurenative.apimanagement.kotlin.inputs.ResponseContractArgs
import com.pulumi.azurenative.apimanagement.kotlin.inputs.ResponseContractArgsBuilder
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

/**
 * API Operation details.
 * Azure REST API version: 2022-08-01. Prior API version in Azure Native 1.x: 2020-12-01.
 * Other available API versions: 2016-07-07, 2016-10-10, 2022-09-01-preview, 2023-03-01-preview, 2023-05-01-preview, 2023-09-01-preview, 2024-05-01.
 * ## Example Usage
 * ### ApiManagementCreateApiOperation
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var apiOperation = new AzureNative.ApiManagement.ApiOperation("apiOperation", new()
 *     {
 *         ApiId = "PetStoreTemplate2",
 *         Description = "This can only be done by the logged in user.",
 *         DisplayName = "createUser2",
 *         Method = "POST",
 *         OperationId = "newoperations",
 *         Request = new AzureNative.ApiManagement.Inputs.RequestContractArgs
 *         {
 *             Description = "Created user object",
 *             Headers = new() { },
 *             QueryParameters = new() { },
 *             Representations = new[]
 *             {
 *                 new AzureNative.ApiManagement.Inputs.RepresentationContractArgs
 *                 {
 *                     ContentType = "application/json",
 *                     SchemaId = "592f6c1d0af5840ca8897f0c",
 *                     TypeName = "User",
 *                 },
 *             },
 *         },
 *         ResourceGroupName = "rg1",
 *         Responses = new[]
 *         {
 *             new AzureNative.ApiManagement.Inputs.ResponseContractArgs
 *             {
 *                 Description = "successful operation",
 *                 Headers = new() { },
 *                 Representations = new[]
 *                 {
 *                     new AzureNative.ApiManagement.Inputs.RepresentationContractArgs
 *                     {
 *                         ContentType = "application/xml",
 *                     },
 *                     new AzureNative.ApiManagement.Inputs.RepresentationContractArgs
 *                     {
 *                         ContentType = "application/json",
 *                     },
 *                 },
 *                 StatusCode = 200,
 *             },
 *         },
 *         ServiceName = "apimService1",
 *         TemplateParameters = new[] {},
 *         UrlTemplate = "/user1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	apimanagement "github.com/pulumi/pulumi-azure-native-sdk/apimanagement/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := apimanagement.NewApiOperation(ctx, "apiOperation", &apimanagement.ApiOperationArgs{
 * 			ApiId:       pulumi.String("PetStoreTemplate2"),
 * 			Description: pulumi.String("This can only be done by the logged in user."),
 * 			DisplayName: pulumi.String("createUser2"),
 * 			Method:      pulumi.String("POST"),
 * 			OperationId: pulumi.String("newoperations"),
 * 			Request: &apimanagement.RequestContractArgs{
 * 				Description:     pulumi.String("Created user object"),
 * 				Headers:         apimanagement.ParameterContractArray{},
 * 				QueryParameters: apimanagement.ParameterContractArray{},
 * 				Representations: apimanagement.RepresentationContractArray{
 * 					&apimanagement.RepresentationContractArgs{
 * 						ContentType: pulumi.String("application/json"),
 * 						SchemaId:    pulumi.String("592f6c1d0af5840ca8897f0c"),
 * 						TypeName:    pulumi.String("User"),
 * 					},
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			Responses: apimanagement.ResponseContractArray{
 * 				&apimanagement.ResponseContractArgs{
 * 					Description: pulumi.String("successful operation"),
 * 					Headers:     apimanagement.ParameterContractArray{},
 * 					Representations: apimanagement.RepresentationContractArray{
 * 						&apimanagement.RepresentationContractArgs{
 * 							ContentType: pulumi.String("application/xml"),
 * 						},
 * 						&apimanagement.RepresentationContractArgs{
 * 							ContentType: pulumi.String("application/json"),
 * 						},
 * 					},
 * 					StatusCode: pulumi.Int(200),
 * 				},
 * 			},
 * 			ServiceName:        pulumi.String("apimService1"),
 * 			TemplateParameters: apimanagement.ParameterContractArray{},
 * 			UrlTemplate:        pulumi.String("/user1"),
 * 		})
 * 		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.azurenative.apimanagement.ApiOperation;
 * import com.pulumi.azurenative.apimanagement.ApiOperationArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.RequestContractArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.ResponseContractArgs;
 * 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 apiOperation = new ApiOperation("apiOperation", ApiOperationArgs.builder()
 *             .apiId("PetStoreTemplate2")
 *             .description("This can only be done by the logged in user.")
 *             .displayName("createUser2")
 *             .method("POST")
 *             .operationId("newoperations")
 *             .request(RequestContractArgs.builder()
 *                 .description("Created user object")
 *                 .headers()
 *                 .queryParameters()
 *                 .representations(RepresentationContractArgs.builder()
 *                     .contentType("application/json")
 *                     .schemaId("592f6c1d0af5840ca8897f0c")
 *                     .typeName("User")
 *                     .build())
 *                 .build())
 *             .resourceGroupName("rg1")
 *             .responses(ResponseContractArgs.builder()
 *                 .description("successful operation")
 *                 .headers()
 *                 .representations(
 *                     RepresentationContractArgs.builder()
 *                         .contentType("application/xml")
 *                         .build(),
 *                     RepresentationContractArgs.builder()
 *                         .contentType("application/json")
 *                         .build())
 *                 .statusCode(200)
 *                 .build())
 *             .serviceName("apimService1")
 *             .templateParameters()
 *             .urlTemplate("/user1")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:apimanagement:ApiOperation newoperations /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}
 * ```
 * @property apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.
 * @property description Description of the operation. May include HTML formatting tags.
 * @property displayName Operation Name.
 * @property method A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them.
 * @property operationId Operation identifier within an API. Must be unique in the current API Management service instance.
 * @property policies Operation Policies
 * @property request An entity containing request details.
 * @property resourceGroupName The name of the resource group. The name is case insensitive.
 * @property responses Array of Operation responses.
 * @property serviceName The name of the API Management service.
 * @property templateParameters Collection of URL template parameters.
 * @property urlTemplate Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}
 */
public data class ApiOperationArgs(
    public val apiId: Output? = null,
    public val description: Output? = null,
    public val displayName: Output? = null,
    public val method: Output? = null,
    public val operationId: Output? = null,
    public val policies: Output? = null,
    public val request: Output? = null,
    public val resourceGroupName: Output? = null,
    public val responses: Output>? = null,
    public val serviceName: Output? = null,
    public val templateParameters: Output>? = null,
    public val urlTemplate: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.apimanagement.ApiOperationArgs =
        com.pulumi.azurenative.apimanagement.ApiOperationArgs.builder()
            .apiId(apiId?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .method(method?.applyValue({ args0 -> args0 }))
            .operationId(operationId?.applyValue({ args0 -> args0 }))
            .policies(policies?.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()
                        })
                    })
                }),
            )
            .serviceName(serviceName?.applyValue({ args0 -> args0 }))
            .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 apiId: Output? = null

    private var description: Output? = null

    private var displayName: Output? = null

    private var method: Output? = null

    private var operationId: Output? = null

    private var policies: Output? = null

    private var request: Output? = null

    private var resourceGroupName: Output? = null

    private var responses: Output>? = null

    private var serviceName: Output? = null

    private var templateParameters: Output>? = null

    private var urlTemplate: Output? = null

    /**
     * @param value API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.
     */
    @JvmName("suidwhjampbjxoai")
    public suspend fun apiId(`value`: Output) {
        this.apiId = value
    }

    /**
     * @param value Description of the operation. May include HTML formatting tags.
     */
    @JvmName("whogsqexodvlqajo")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Operation Name.
     */
    @JvmName("swcmdkkiishwakug")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them.
     */
    @JvmName("mcsvnupscckfrqgn")
    public suspend fun method(`value`: Output) {
        this.method = value
    }

    /**
     * @param value Operation identifier within an API. Must be unique in the current API Management service instance.
     */
    @JvmName("xcnnwxliycixqmnu")
    public suspend fun operationId(`value`: Output) {
        this.operationId = value
    }

    /**
     * @param value Operation Policies
     */
    @JvmName("iobxwphxeiglebun")
    public suspend fun policies(`value`: Output) {
        this.policies = value
    }

    /**
     * @param value An entity containing request details.
     */
    @JvmName("djqrrjreybwntrfu")
    public suspend fun request(`value`: Output) {
        this.request = value
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("vogbihpgkiaetsco")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Array of Operation responses.
     */
    @JvmName("iqkwowcqalsihrfj")
    public suspend fun responses(`value`: Output>) {
        this.responses = value
    }

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

    /**
     * @param values Array of Operation responses.
     */
    @JvmName("fstwskfojqpssukx")
    public suspend fun responses(values: List>) {
        this.responses = Output.all(values)
    }

    /**
     * @param value The name of the API Management service.
     */
    @JvmName("iuseumqidfhuofbd")
    public suspend fun serviceName(`value`: Output) {
        this.serviceName = value
    }

    /**
     * @param value Collection of URL template parameters.
     */
    @JvmName("vdvsbkejqerjgcny")
    public suspend fun templateParameters(`value`: Output>) {
        this.templateParameters = value
    }

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

    /**
     * @param values Collection of URL template parameters.
     */
    @JvmName("higllgboeylfnmyi")
    public suspend fun templateParameters(values: List>) {
        this.templateParameters = Output.all(values)
    }

    /**
     * @param value Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}
     */
    @JvmName("jbppnbujvkqrphxi")
    public suspend fun urlTemplate(`value`: Output) {
        this.urlTemplate = value
    }

    /**
     * @param value API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.
     */
    @JvmName("leeltmwwefbfotlp")
    public suspend fun apiId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.apiId = mapped
    }

    /**
     * @param value Description of the operation. May include HTML formatting tags.
     */
    @JvmName("ydqkjbqpfiywadqt")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

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

    /**
     * @param value A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them.
     */
    @JvmName("ttceoilgxdslipgv")
    public suspend fun method(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.method = mapped
    }

    /**
     * @param value Operation identifier within an API. Must be unique in the current API Management service instance.
     */
    @JvmName("ciskcjhogtckrhpj")
    public suspend fun operationId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.operationId = mapped
    }

    /**
     * @param value Operation Policies
     */
    @JvmName("cpqswbgeddhbwhly")
    public suspend fun policies(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param value An entity containing request details.
     */
    @JvmName("mlubkeanpyllrvgc")
    public suspend fun request(`value`: RequestContractArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.request = mapped
    }

    /**
     * @param argument An entity containing request details.
     */
    @JvmName("ceoadxlcafqluurk")
    public suspend fun request(argument: suspend RequestContractArgsBuilder.() -> Unit) {
        val toBeMapped = RequestContractArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.request = mapped
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("xuiaykesplpgfetp")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Array of Operation responses.
     */
    @JvmName("jpxtpftptmhgwewr")
    public suspend fun responses(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.responses = mapped
    }

    /**
     * @param argument Array of Operation responses.
     */
    @JvmName("isswwokgqgymrvto")
    public suspend fun responses(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ResponseContractArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param argument Array of Operation responses.
     */
    @JvmName("vlhulbbhbggqecgp")
    public suspend fun responses(vararg argument: suspend ResponseContractArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ResponseContractArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param argument Array of Operation responses.
     */
    @JvmName("hgskhoawithdhfwt")
    public suspend fun responses(argument: suspend ResponseContractArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ResponseContractArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.responses = mapped
    }

    /**
     * @param values Array of Operation responses.
     */
    @JvmName("dydfwjobtvcxlgbn")
    public suspend fun responses(vararg values: ResponseContractArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.responses = mapped
    }

    /**
     * @param value The name of the API Management service.
     */
    @JvmName("dfrkknmqvtvuagrd")
    public suspend fun serviceName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceName = mapped
    }

    /**
     * @param value Collection of URL template parameters.
     */
    @JvmName("syvwlbphkbekgiec")
    public suspend fun templateParameters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.templateParameters = mapped
    }

    /**
     * @param argument Collection of URL template parameters.
     */
    @JvmName("anmyymonjbclaior")
    public suspend fun templateParameters(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ParameterContractArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param argument Collection of URL template parameters.
     */
    @JvmName("nbxktvnxftlfdgfv")
    public suspend fun templateParameters(vararg argument: suspend ParameterContractArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ParameterContractArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param argument Collection of URL template parameters.
     */
    @JvmName("fekgptybvjbfctpi")
    public suspend fun templateParameters(argument: suspend ParameterContractArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ParameterContractArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.templateParameters = mapped
    }

    /**
     * @param values Collection of URL template parameters.
     */
    @JvmName("krfawjqkqwvhuioc")
    public suspend fun templateParameters(vararg values: ParameterContractArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.templateParameters = mapped
    }

    /**
     * @param value Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}
     */
    @JvmName("qoeglpbohnxyarjh")
    public suspend fun urlTemplate(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.urlTemplate = mapped
    }

    internal fun build(): ApiOperationArgs = ApiOperationArgs(
        apiId = apiId,
        description = description,
        displayName = displayName,
        method = method,
        operationId = operationId,
        policies = policies,
        request = request,
        resourceGroupName = resourceGroupName,
        responses = responses,
        serviceName = serviceName,
        templateParameters = templateParameters,
        urlTemplate = urlTemplate,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy