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

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

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

package com.pulumi.azurenative.apimanagement.kotlin

import com.pulumi.azurenative.apimanagement.AuthorizationArgs.builder
import com.pulumi.azurenative.apimanagement.kotlin.enums.AuthorizationType
import com.pulumi.azurenative.apimanagement.kotlin.enums.OAuth2GrantType
import com.pulumi.azurenative.apimanagement.kotlin.inputs.AuthorizationErrorArgs
import com.pulumi.azurenative.apimanagement.kotlin.inputs.AuthorizationErrorArgsBuilder
import com.pulumi.core.Either
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Authorization contract.
 * Azure REST API version: 2022-08-01.
 * Other available API versions: 2022-09-01-preview, 2023-03-01-preview, 2023-05-01-preview, 2023-09-01-preview, 2024-05-01.
 * ## Example Usage
 * ### ApiManagementCreateAuthorizationAADAuthCode
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var authorization = new AzureNative.ApiManagement.Authorization("authorization", new()
 *     {
 *         AuthorizationId = "authz2",
 *         AuthorizationProviderId = "aadwithauthcode",
 *         AuthorizationType = AzureNative.ApiManagement.AuthorizationType.OAuth2,
 *         OAuth2GrantType = AzureNative.ApiManagement.OAuth2GrantType.AuthorizationCode,
 *         ResourceGroupName = "rg1",
 *         ServiceName = "apimService1",
 *     });
 * });
 * ```
 * ```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.NewAuthorization(ctx, "authorization", &apimanagement.AuthorizationArgs{
 * 			AuthorizationId:         pulumi.String("authz2"),
 * 			AuthorizationProviderId: pulumi.String("aadwithauthcode"),
 * 			AuthorizationType:       pulumi.String(apimanagement.AuthorizationTypeOAuth2),
 * 			OAuth2GrantType:         pulumi.String(apimanagement.OAuth2GrantTypeAuthorizationCode),
 * 			ResourceGroupName:       pulumi.String("rg1"),
 * 			ServiceName:             pulumi.String("apimService1"),
 * 		})
 * 		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.Authorization;
 * import com.pulumi.azurenative.apimanagement.AuthorizationArgs;
 * 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 authorization = new Authorization("authorization", AuthorizationArgs.builder()
 *             .authorizationId("authz2")
 *             .authorizationProviderId("aadwithauthcode")
 *             .authorizationType("OAuth2")
 *             .oAuth2GrantType("AuthorizationCode")
 *             .resourceGroupName("rg1")
 *             .serviceName("apimService1")
 *             .build());
 *     }
 * }
 * ```
 * ### ApiManagementCreateAuthorizationAADClientCred
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var authorization = new AzureNative.ApiManagement.Authorization("authorization", new()
 *     {
 *         AuthorizationId = "authz1",
 *         AuthorizationProviderId = "aadwithclientcred",
 *         AuthorizationType = AzureNative.ApiManagement.AuthorizationType.OAuth2,
 *         OAuth2GrantType = AzureNative.ApiManagement.OAuth2GrantType.AuthorizationCode,
 *         Parameters =
 *         {
 *             { "clientId", "53790925-fdd3-4b80-bc7a-4c3aaf25801d" },
 *             { "clientSecret", "xxxxxxxxxxxxxxx~xxxxxxxxx" },
 *         },
 *         ResourceGroupName = "rg1",
 *         ServiceName = "apimService1",
 *     });
 * });
 * ```
 * ```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.NewAuthorization(ctx, "authorization", &apimanagement.AuthorizationArgs{
 * 			AuthorizationId:         pulumi.String("authz1"),
 * 			AuthorizationProviderId: pulumi.String("aadwithclientcred"),
 * 			AuthorizationType:       pulumi.String(apimanagement.AuthorizationTypeOAuth2),
 * 			OAuth2GrantType:         pulumi.String(apimanagement.OAuth2GrantTypeAuthorizationCode),
 * 			Parameters: pulumi.StringMap{
 * 				"clientId":     pulumi.String("53790925-fdd3-4b80-bc7a-4c3aaf25801d"),
 * 				"clientSecret": pulumi.String("xxxxxxxxxxxxxxx~xxxxxxxxx"),
 * 			},
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			ServiceName:       pulumi.String("apimService1"),
 * 		})
 * 		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.Authorization;
 * import com.pulumi.azurenative.apimanagement.AuthorizationArgs;
 * 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 authorization = new Authorization("authorization", AuthorizationArgs.builder()
 *             .authorizationId("authz1")
 *             .authorizationProviderId("aadwithclientcred")
 *             .authorizationType("OAuth2")
 *             .oAuth2GrantType("AuthorizationCode")
 *             .parameters(Map.ofEntries(
 *                 Map.entry("clientId", "53790925-fdd3-4b80-bc7a-4c3aaf25801d"),
 *                 Map.entry("clientSecret", "xxxxxxxxxxxxxxx~xxxxxxxxx")
 *             ))
 *             .resourceGroupName("rg1")
 *             .serviceName("apimService1")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:apimanagement:Authorization authz1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}
 * ```
 * @property authorizationId Identifier of the authorization.
 * @property authorizationProviderId Identifier of the authorization provider.
 * @property authorizationType Authorization type options
 * @property error Authorization error details.
 * @property oAuth2GrantType OAuth2 grant type options
 * @property parameters Authorization parameters
 * @property resourceGroupName The name of the resource group. The name is case insensitive.
 * @property serviceName The name of the API Management service.
 * @property status Status of the Authorization
 */
public data class AuthorizationArgs(
    public val authorizationId: Output? = null,
    public val authorizationProviderId: Output? = null,
    public val authorizationType: Output>? = null,
    public val error: Output? = null,
    public val oAuth2GrantType: Output>? = null,
    public val parameters: Output>? = null,
    public val resourceGroupName: Output? = null,
    public val serviceName: Output? = null,
    public val status: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.apimanagement.AuthorizationArgs =
        com.pulumi.azurenative.apimanagement.AuthorizationArgs.builder()
            .authorizationId(authorizationId?.applyValue({ args0 -> args0 }))
            .authorizationProviderId(authorizationProviderId?.applyValue({ args0 -> args0 }))
            .authorizationType(
                authorizationType?.applyValue({ args0 ->
                    args0.transform(
                        { args0 -> args0 },
                        { args0 -> args0.let({ args0 -> args0.toJava() }) },
                    )
                }),
            )
            .error(error?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .oAuth2GrantType(
                oAuth2GrantType?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .parameters(
                parameters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .serviceName(serviceName?.applyValue({ args0 -> args0 }))
            .status(status?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AuthorizationArgs].
 */
@PulumiTagMarker
public class AuthorizationArgsBuilder internal constructor() {
    private var authorizationId: Output? = null

    private var authorizationProviderId: Output? = null

    private var authorizationType: Output>? = null

    private var error: Output? = null

    private var oAuth2GrantType: Output>? = null

    private var parameters: Output>? = null

    private var resourceGroupName: Output? = null

    private var serviceName: Output? = null

    private var status: Output? = null

    /**
     * @param value Identifier of the authorization.
     */
    @JvmName("mcucxjubxbetojvv")
    public suspend fun authorizationId(`value`: Output) {
        this.authorizationId = value
    }

    /**
     * @param value Identifier of the authorization provider.
     */
    @JvmName("sbxujogsctmyqygn")
    public suspend fun authorizationProviderId(`value`: Output) {
        this.authorizationProviderId = value
    }

    /**
     * @param value Authorization type options
     */
    @JvmName("twgsfgrmcjqdwamw")
    public suspend fun authorizationType(`value`: Output>) {
        this.authorizationType = value
    }

    /**
     * @param value Authorization error details.
     */
    @JvmName("ncoqwtolfxxlmdfc")
    public suspend fun error(`value`: Output) {
        this.error = value
    }

    /**
     * @param value OAuth2 grant type options
     */
    @JvmName("avpcujcgethcshlv")
    public suspend fun oAuth2GrantType(`value`: Output>) {
        this.oAuth2GrantType = value
    }

    /**
     * @param value Authorization parameters
     */
    @JvmName("asjmpdygwuogllnd")
    public suspend fun parameters(`value`: Output>) {
        this.parameters = value
    }

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

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

    /**
     * @param value Status of the Authorization
     */
    @JvmName("vjdiwwqytaxrjgke")
    public suspend fun status(`value`: Output) {
        this.status = value
    }

    /**
     * @param value Identifier of the authorization.
     */
    @JvmName("hmcngvvjysdutbnn")
    public suspend fun authorizationId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizationId = mapped
    }

    /**
     * @param value Identifier of the authorization provider.
     */
    @JvmName("tqwkrlefqllsyist")
    public suspend fun authorizationProviderId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizationProviderId = mapped
    }

    /**
     * @param value Authorization type options
     */
    @JvmName("icglcewituspqdof")
    public suspend fun authorizationType(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizationType = mapped
    }

    /**
     * @param value Authorization type options
     */
    @JvmName("iesknufktkeuanvi")
    public fun authorizationType(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.authorizationType = mapped
    }

    /**
     * @param value Authorization type options
     */
    @JvmName("iilusaytutorwubv")
    public fun authorizationType(`value`: AuthorizationType) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.authorizationType = mapped
    }

    /**
     * @param value Authorization error details.
     */
    @JvmName("xxovycwmmhrgrara")
    public suspend fun error(`value`: AuthorizationErrorArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.error = mapped
    }

    /**
     * @param argument Authorization error details.
     */
    @JvmName("reunaekbepobmgch")
    public suspend fun error(argument: suspend AuthorizationErrorArgsBuilder.() -> Unit) {
        val toBeMapped = AuthorizationErrorArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.error = mapped
    }

    /**
     * @param value OAuth2 grant type options
     */
    @JvmName("rfqpxjnvmnvepqpb")
    public suspend fun oAuth2GrantType(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.oAuth2GrantType = mapped
    }

    /**
     * @param value OAuth2 grant type options
     */
    @JvmName("vcidmgkeewaypfjf")
    public fun oAuth2GrantType(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.oAuth2GrantType = mapped
    }

    /**
     * @param value OAuth2 grant type options
     */
    @JvmName("mosiyghxxougihtf")
    public fun oAuth2GrantType(`value`: OAuth2GrantType) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.oAuth2GrantType = mapped
    }

    /**
     * @param value Authorization parameters
     */
    @JvmName("lrihpuqivakrcsko")
    public suspend fun parameters(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

    /**
     * @param values Authorization parameters
     */
    @JvmName("upapuiwmoivknjgw")
    public fun parameters(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

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

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

    /**
     * @param value Status of the Authorization
     */
    @JvmName("bawpmuqodakraqjd")
    public suspend fun status(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.status = mapped
    }

    internal fun build(): AuthorizationArgs = AuthorizationArgs(
        authorizationId = authorizationId,
        authorizationProviderId = authorizationProviderId,
        authorizationType = authorizationType,
        error = error,
        oAuth2GrantType = oAuth2GrantType,
        parameters = parameters,
        resourceGroupName = resourceGroupName,
        serviceName = serviceName,
        status = status,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy