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

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

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

package com.pulumi.azurenative.apimanagement.kotlin

import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendBaseParametersResponsePool
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendCircuitBreakerResponse
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendCredentialsContractResponse
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendPropertiesResponse
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendProxyContractResponse
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendTlsPropertiesResponse
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
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendBaseParametersResponsePool.Companion.toKotlin as backendBaseParametersResponsePoolToKotlin
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendCircuitBreakerResponse.Companion.toKotlin as backendCircuitBreakerResponseToKotlin
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendCredentialsContractResponse.Companion.toKotlin as backendCredentialsContractResponseToKotlin
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendPropertiesResponse.Companion.toKotlin as backendPropertiesResponseToKotlin
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendProxyContractResponse.Companion.toKotlin as backendProxyContractResponseToKotlin
import com.pulumi.azurenative.apimanagement.kotlin.outputs.BackendTlsPropertiesResponse.Companion.toKotlin as backendTlsPropertiesResponseToKotlin

/**
 * Builder for [WorkspaceBackend].
 */
@PulumiTagMarker
public class WorkspaceBackendResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: WorkspaceBackendArgs = WorkspaceBackendArgs()

    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 WorkspaceBackendArgsBuilder.() -> Unit) {
        val builder = WorkspaceBackendArgsBuilder()
        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(): WorkspaceBackend {
        val builtJavaResource =
            com.pulumi.azurenative.apimanagement.WorkspaceBackend(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return WorkspaceBackend(builtJavaResource)
    }
}

/**
 * Backend details.
 * Azure REST API version: 2023-09-01-preview.
 * Other available API versions: 2024-05-01.
 * ## Example Usage
 * ### ApiManagementCreateWorkspaceBackendProxyBackend
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var workspaceBackend = new AzureNative.ApiManagement.WorkspaceBackend("workspaceBackend", new()
 *     {
 *         BackendId = "proxybackend",
 *         Credentials = new AzureNative.ApiManagement.Inputs.BackendCredentialsContractArgs
 *         {
 *             Authorization = new AzureNative.ApiManagement.Inputs.BackendAuthorizationHeaderCredentialsArgs
 *             {
 *                 Parameter = "opensesma",
 *                 Scheme = "Basic",
 *             },
 *             Header =
 *             {
 *                 { "x-my-1", new[]
 *                 {
 *                     "val1",
 *                     "val2",
 *                 } },
 *             },
 *             Query =
 *             {
 *                 { "sv", new[]
 *                 {
 *                     "xx",
 *                     "bb",
 *                     "cc",
 *                 } },
 *             },
 *         },
 *         Description = "description5308",
 *         Protocol = AzureNative.ApiManagement.BackendProtocol.Http,
 *         Proxy = new AzureNative.ApiManagement.Inputs.BackendProxyContractArgs
 *         {
 *             Password = "",
 *             Url = "http://192.168.1.1:8080",
 *             Username = "Contoso\\admin",
 *         },
 *         ResourceGroupName = "rg1",
 *         ServiceName = "apimService1",
 *         Tls = new AzureNative.ApiManagement.Inputs.BackendTlsPropertiesArgs
 *         {
 *             ValidateCertificateChain = true,
 *             ValidateCertificateName = true,
 *         },
 *         Url = "https://backendname2644/",
 *         WorkspaceId = "wks1",
 *     });
 * });
 * ```
 * ```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.NewWorkspaceBackend(ctx, "workspaceBackend", &apimanagement.WorkspaceBackendArgs{
 * 			BackendId: pulumi.String("proxybackend"),
 * 			Credentials: &apimanagement.BackendCredentialsContractArgs{
 * 				Authorization: &apimanagement.BackendAuthorizationHeaderCredentialsArgs{
 * 					Parameter: pulumi.String("opensesma"),
 * 					Scheme:    pulumi.String("Basic"),
 * 				},
 * 				Header: pulumi.StringArrayMap{
 * 					"x-my-1": pulumi.StringArray{
 * 						pulumi.String("val1"),
 * 						pulumi.String("val2"),
 * 					},
 * 				},
 * 				Query: pulumi.StringArrayMap{
 * 					"sv": pulumi.StringArray{
 * 						pulumi.String("xx"),
 * 						pulumi.String("bb"),
 * 						pulumi.String("cc"),
 * 					},
 * 				},
 * 			},
 * 			Description: pulumi.String("description5308"),
 * 			Protocol:    pulumi.String(apimanagement.BackendProtocolHttp),
 * 			Proxy: &apimanagement.BackendProxyContractArgs{
 * 				Password: pulumi.String(""),
 * 				Url:      pulumi.String("http://192.168.1.1:8080"),
 * 				Username: pulumi.String("Contoso\\admin"),
 * 			},
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			ServiceName:       pulumi.String("apimService1"),
 * 			Tls: &apimanagement.BackendTlsPropertiesArgs{
 * 				ValidateCertificateChain: pulumi.Bool(true),
 * 				ValidateCertificateName:  pulumi.Bool(true),
 * 			},
 * 			Url:         pulumi.String("https://backendname2644/"),
 * 			WorkspaceId: pulumi.String("wks1"),
 * 		})
 * 		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.WorkspaceBackend;
 * import com.pulumi.azurenative.apimanagement.WorkspaceBackendArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendCredentialsContractArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendAuthorizationHeaderCredentialsArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendProxyContractArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendTlsPropertiesArgs;
 * 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 workspaceBackend = new WorkspaceBackend("workspaceBackend", WorkspaceBackendArgs.builder()
 *             .backendId("proxybackend")
 *             .credentials(BackendCredentialsContractArgs.builder()
 *                 .authorization(BackendAuthorizationHeaderCredentialsArgs.builder()
 *                     .parameter("opensesma")
 *                     .scheme("Basic")
 *                     .build())
 *                 .header(Map.of("x-my-1",
 *                     "val1",
 *                     "val2"))
 *                 .query(Map.of("sv",
 *                     "xx",
 *                     "bb",
 *                     "cc"))
 *                 .build())
 *             .description("description5308")
 *             .protocol("http")
 *             .proxy(BackendProxyContractArgs.builder()
 *                 .password("")
 *                 .url("http://192.168.1.1:8080")
 *                 .username("Contoso\\admin")
 *                 .build())
 *             .resourceGroupName("rg1")
 *             .serviceName("apimService1")
 *             .tls(BackendTlsPropertiesArgs.builder()
 *                 .validateCertificateChain(true)
 *                 .validateCertificateName(true)
 *                 .build())
 *             .url("https://backendname2644/")
 *             .workspaceId("wks1")
 *             .build());
 *     }
 * }
 * ```
 * ### ApiManagementCreateWorkspaceBackendServiceFabric
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var workspaceBackend = new AzureNative.ApiManagement.WorkspaceBackend("workspaceBackend", new()
 *     {
 *         BackendId = "sfbackend",
 *         Description = "Service Fabric Test App 1",
 *         Properties = new AzureNative.ApiManagement.Inputs.BackendPropertiesArgs
 *         {
 *             ServiceFabricCluster = new AzureNative.ApiManagement.Inputs.BackendServiceFabricClusterPropertiesArgs
 *             {
 *                 ClientCertificateId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/certificates/cert1",
 *                 ManagementEndpoints = new[]
 *                 {
 *                     "https://somecluster.com",
 *                 },
 *                 MaxPartitionResolutionRetries = 5,
 *                 ServerX509Names = new[]
 *                 {
 *                     new AzureNative.ApiManagement.Inputs.X509CertificateNameArgs
 *                     {
 *                         IssuerCertificateThumbprint = "IssuerCertificateThumbprint1",
 *                         Name = "ServerCommonName1",
 *                     },
 *                 },
 *             },
 *         },
 *         Protocol = AzureNative.ApiManagement.BackendProtocol.Http,
 *         ResourceGroupName = "rg1",
 *         ServiceName = "apimService1",
 *         Url = "fabric:/mytestapp/mytestservice",
 *         WorkspaceId = "wks1",
 *     });
 * });
 * ```
 * ```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.NewWorkspaceBackend(ctx, "workspaceBackend", &apimanagement.WorkspaceBackendArgs{
 * 			BackendId:   pulumi.String("sfbackend"),
 * 			Description: pulumi.String("Service Fabric Test App 1"),
 * 			Properties: &apimanagement.BackendPropertiesArgs{
 * 				ServiceFabricCluster: &apimanagement.BackendServiceFabricClusterPropertiesArgs{
 * 					ClientCertificateId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/certificates/cert1"),
 * 					ManagementEndpoints: pulumi.StringArray{
 * 						pulumi.String("https://somecluster.com"),
 * 					},
 * 					MaxPartitionResolutionRetries: pulumi.Int(5),
 * 					ServerX509Names: apimanagement.X509CertificateNameArray{
 * 						&apimanagement.X509CertificateNameArgs{
 * 							IssuerCertificateThumbprint: pulumi.String("IssuerCertificateThumbprint1"),
 * 							Name:                        pulumi.String("ServerCommonName1"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 			Protocol:          pulumi.String(apimanagement.BackendProtocolHttp),
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			ServiceName:       pulumi.String("apimService1"),
 * 			Url:               pulumi.String("fabric:/mytestapp/mytestservice"),
 * 			WorkspaceId:       pulumi.String("wks1"),
 * 		})
 * 		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.WorkspaceBackend;
 * import com.pulumi.azurenative.apimanagement.WorkspaceBackendArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendPropertiesArgs;
 * import com.pulumi.azurenative.apimanagement.inputs.BackendServiceFabricClusterPropertiesArgs;
 * 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 workspaceBackend = new WorkspaceBackend("workspaceBackend", WorkspaceBackendArgs.builder()
 *             .backendId("sfbackend")
 *             .description("Service Fabric Test App 1")
 *             .properties(BackendPropertiesArgs.builder()
 *                 .serviceFabricCluster(BackendServiceFabricClusterPropertiesArgs.builder()
 *                     .clientCertificateId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/certificates/cert1")
 *                     .managementEndpoints("https://somecluster.com")
 *                     .maxPartitionResolutionRetries(5)
 *                     .serverX509Names(X509CertificateNameArgs.builder()
 *                         .issuerCertificateThumbprint("IssuerCertificateThumbprint1")
 *                         .name("ServerCommonName1")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .protocol("http")
 *             .resourceGroupName("rg1")
 *             .serviceName("apimService1")
 *             .url("fabric:/mytestapp/mytestservice")
 *             .workspaceId("wks1")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:apimanagement:WorkspaceBackend sfbackend /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}
 * ```
 */
public class WorkspaceBackend internal constructor(
    override val javaResource: com.pulumi.azurenative.apimanagement.WorkspaceBackend,
) : KotlinCustomResource(javaResource, WorkspaceBackendMapper) {
    /**
     * Backend Circuit Breaker Configuration
     */
    public val circuitBreaker: Output?
        get() = javaResource.circuitBreaker().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> backendCircuitBreakerResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Backend Credentials Contract Properties
     */
    public val credentials: Output?
        get() = javaResource.credentials().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    backendCredentialsContractResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Backend Description.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val pool: Output?
        get() = javaResource.pool().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    backendBaseParametersResponsePoolToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Backend Properties contract
     */
    public val properties: Output
        get() = javaResource.properties().applyValue({ args0 ->
            args0.let({ args0 ->
                backendPropertiesResponseToKotlin(args0)
            })
        })

    /**
     * Backend communication protocol.
     */
    public val protocol: Output
        get() = javaResource.protocol().applyValue({ args0 -> args0 })

    /**
     * Backend gateway Contract Properties
     */
    public val proxy: Output?
        get() = javaResource.proxy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    backendProxyContractResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps.
     */
    public val resourceId: Output?
        get() = javaResource.resourceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Backend Title.
     */
    public val title: Output?
        get() = javaResource.title().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Backend TLS Properties
     */
    public val tls: Output?
        get() = javaResource.tls().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    backendTlsPropertiesResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Runtime Url of the Backend.
     */
    public val url: Output
        get() = javaResource.url().applyValue({ args0 -> args0 })
}

public object WorkspaceBackendMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.apimanagement.WorkspaceBackend::class == javaResource::class

    override fun map(javaResource: Resource): WorkspaceBackend = WorkspaceBackend(
        javaResource as
            com.pulumi.azurenative.apimanagement.WorkspaceBackend,
    )
}

/**
 * @see [WorkspaceBackend].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [WorkspaceBackend].
 */
public suspend fun workspaceBackend(
    name: String,
    block: suspend WorkspaceBackendResourceBuilder.() -> Unit,
): WorkspaceBackend {
    val builder = WorkspaceBackendResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [WorkspaceBackend].
 * @param name The _unique_ name of the resulting resource.
 */
public fun workspaceBackend(name: String): WorkspaceBackend {
    val builder = WorkspaceBackendResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy