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

com.pulumi.azure.healthcare.kotlin.Service.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.healthcare.kotlin

import com.pulumi.azure.healthcare.kotlin.outputs.ServiceAuthenticationConfiguration
import com.pulumi.azure.healthcare.kotlin.outputs.ServiceCorsConfiguration
import com.pulumi.azure.healthcare.kotlin.outputs.ServiceIdentity
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.healthcare.kotlin.outputs.ServiceAuthenticationConfiguration.Companion.toKotlin as serviceAuthenticationConfigurationToKotlin
import com.pulumi.azure.healthcare.kotlin.outputs.ServiceCorsConfiguration.Companion.toKotlin as serviceCorsConfigurationToKotlin
import com.pulumi.azure.healthcare.kotlin.outputs.ServiceIdentity.Companion.toKotlin as serviceIdentityToKotlin

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

    public var args: ServiceArgs = ServiceArgs()

    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 ServiceArgsBuilder.() -> Unit) {
        val builder = ServiceArgsBuilder()
        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(): Service {
        val builtJavaResource = com.pulumi.azure.healthcare.Service(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Service(builtJavaResource)
    }
}

/**
 * Manages a Healthcare Service.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.healthcare.Service("example", {
 *     name: "uniquefhirname",
 *     resourceGroupName: "sample-resource-group",
 *     location: "westus2",
 *     kind: "fhir-R4",
 *     cosmosdbThroughput: 2000,
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 *     accessPolicyObjectIds: current.then(current => current.objectId),
 *     configurationExportStorageAccountName: "teststorage",
 *     tags: {
 *         environment: "testenv",
 *         purpose: "AcceptanceTests",
 *     },
 *     authenticationConfiguration: {
 *         authority: "https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D",
 *         audience: "https://azurehealthcareapis.com/",
 *         smartProxyEnabled: true,
 *     },
 *     corsConfiguration: {
 *         allowedOrigins: [
 *             "http://www.example.com",
 *             "http://www.example2.com",
 *         ],
 *         allowedHeaders: [
 *             "x-tempo-*",
 *             "x-tempo2-*",
 *         ],
 *         allowedMethods: [
 *             "GET",
 *             "PUT",
 *         ],
 *         maxAgeInSeconds: 500,
 *         allowCredentials: true,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.healthcare.Service("example",
 *     name="uniquefhirname",
 *     resource_group_name="sample-resource-group",
 *     location="westus2",
 *     kind="fhir-R4",
 *     cosmosdb_throughput=2000,
 *     identity={
 *         "type": "SystemAssigned",
 *     },
 *     access_policy_object_ids=current.object_id,
 *     configuration_export_storage_account_name="teststorage",
 *     tags={
 *         "environment": "testenv",
 *         "purpose": "AcceptanceTests",
 *     },
 *     authentication_configuration={
 *         "authority": "https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D",
 *         "audience": "https://azurehealthcareapis.com/",
 *         "smart_proxy_enabled": True,
 *     },
 *     cors_configuration={
 *         "allowed_origins": [
 *             "http://www.example.com",
 *             "http://www.example2.com",
 *         ],
 *         "allowed_headers": [
 *             "x-tempo-*",
 *             "x-tempo2-*",
 *         ],
 *         "allowed_methods": [
 *             "GET",
 *             "PUT",
 *         ],
 *         "max_age_in_seconds": 500,
 *         "allow_credentials": True,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var example = new Azure.Healthcare.Service("example", new()
 *     {
 *         Name = "uniquefhirname",
 *         ResourceGroupName = "sample-resource-group",
 *         Location = "westus2",
 *         Kind = "fhir-R4",
 *         CosmosdbThroughput = 2000,
 *         Identity = new Azure.Healthcare.Inputs.ServiceIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *         AccessPolicyObjectIds = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *         ConfigurationExportStorageAccountName = "teststorage",
 *         Tags =
 *         {
 *             { "environment", "testenv" },
 *             { "purpose", "AcceptanceTests" },
 *         },
 *         AuthenticationConfiguration = new Azure.Healthcare.Inputs.ServiceAuthenticationConfigurationArgs
 *         {
 *             Authority = "https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D",
 *             Audience = "https://azurehealthcareapis.com/",
 *             SmartProxyEnabled = true,
 *         },
 *         CorsConfiguration = new Azure.Healthcare.Inputs.ServiceCorsConfigurationArgs
 *         {
 *             AllowedOrigins = new[]
 *             {
 *                 "http://www.example.com",
 *                 "http://www.example2.com",
 *             },
 *             AllowedHeaders = new[]
 *             {
 *                 "x-tempo-*",
 *                 "x-tempo2-*",
 *             },
 *             AllowedMethods = new[]
 *             {
 *                 "GET",
 *                 "PUT",
 *             },
 *             MaxAgeInSeconds = 500,
 *             AllowCredentials = true,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/healthcare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = healthcare.NewService(ctx, "example", &healthcare.ServiceArgs{
 * 			Name:               pulumi.String("uniquefhirname"),
 * 			ResourceGroupName:  pulumi.String("sample-resource-group"),
 * 			Location:           pulumi.String("westus2"),
 * 			Kind:               pulumi.String("fhir-R4"),
 * 			CosmosdbThroughput: pulumi.Int(2000),
 * 			Identity: &healthcare.ServiceIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 			AccessPolicyObjectIds:                 pulumi.String(current.ObjectId),
 * 			ConfigurationExportStorageAccountName: pulumi.String("teststorage"),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("testenv"),
 * 				"purpose":     pulumi.String("AcceptanceTests"),
 * 			},
 * 			AuthenticationConfiguration: &healthcare.ServiceAuthenticationConfigurationArgs{
 * 				Authority:         pulumi.String("https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D"),
 * 				Audience:          pulumi.String("https://azurehealthcareapis.com/"),
 * 				SmartProxyEnabled: pulumi.Bool(true),
 * 			},
 * 			CorsConfiguration: &healthcare.ServiceCorsConfigurationArgs{
 * 				AllowedOrigins: pulumi.StringArray{
 * 					pulumi.String("http://www.example.com"),
 * 					pulumi.String("http://www.example2.com"),
 * 				},
 * 				AllowedHeaders: pulumi.StringArray{
 * 					pulumi.String("x-tempo-*"),
 * 					pulumi.String("x-tempo2-*"),
 * 				},
 * 				AllowedMethods: pulumi.StringArray{
 * 					pulumi.String("GET"),
 * 					pulumi.String("PUT"),
 * 				},
 * 				MaxAgeInSeconds:  pulumi.Int(500),
 * 				AllowCredentials: pulumi.Bool(true),
 * 			},
 * 		})
 * 		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.core.CoreFunctions;
 * import com.pulumi.azure.healthcare.Service;
 * import com.pulumi.azure.healthcare.ServiceArgs;
 * import com.pulumi.azure.healthcare.inputs.ServiceIdentityArgs;
 * import com.pulumi.azure.healthcare.inputs.ServiceAuthenticationConfigurationArgs;
 * import com.pulumi.azure.healthcare.inputs.ServiceCorsConfigurationArgs;
 * 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 current = CoreFunctions.getClientConfig();
 *         var example = new Service("example", ServiceArgs.builder()
 *             .name("uniquefhirname")
 *             .resourceGroupName("sample-resource-group")
 *             .location("westus2")
 *             .kind("fhir-R4")
 *             .cosmosdbThroughput("2000")
 *             .identity(ServiceIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .accessPolicyObjectIds(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .configurationExportStorageAccountName("teststorage")
 *             .tags(Map.ofEntries(
 *                 Map.entry("environment", "testenv"),
 *                 Map.entry("purpose", "AcceptanceTests")
 *             ))
 *             .authenticationConfiguration(ServiceAuthenticationConfigurationArgs.builder()
 *                 .authority("https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D")
 *                 .audience("https://azurehealthcareapis.com/")
 *                 .smartProxyEnabled("true")
 *                 .build())
 *             .corsConfiguration(ServiceCorsConfigurationArgs.builder()
 *                 .allowedOrigins(
 *                     "http://www.example.com",
 *                     "http://www.example2.com")
 *                 .allowedHeaders(
 *                     "x-tempo-*",
 *                     "x-tempo2-*")
 *                 .allowedMethods(
 *                     "GET",
 *                     "PUT")
 *                 .maxAgeInSeconds("500")
 *                 .allowCredentials("true")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:healthcare:Service
 *     properties:
 *       name: uniquefhirname
 *       resourceGroupName: sample-resource-group
 *       location: westus2
 *       kind: fhir-R4
 *       cosmosdbThroughput: '2000'
 *       identity:
 *         type: SystemAssigned
 *       accessPolicyObjectIds: ${current.objectId}
 *       configurationExportStorageAccountName: teststorage
 *       tags:
 *         environment: testenv
 *         purpose: AcceptanceTests
 *       authenticationConfiguration:
 *         authority: https://login.microsoftonline.com/$%7Bdata.azurerm_client_config.current.tenant_id%7D
 *         audience: https://azurehealthcareapis.com/
 *         smartProxyEnabled: 'true'
 *       corsConfiguration:
 *         allowedOrigins:
 *           - http://www.example.com
 *           - http://www.example2.com
 *         allowedHeaders:
 *           - x-tempo-*
 *           - x-tempo2-*
 *         allowedMethods:
 *           - GET
 *           - PUT
 *         maxAgeInSeconds: '500'
 *         allowCredentials: 'true'
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Healthcare Service can be imported using the resource`id`, e.g.
 * ```sh
 * $ pulumi import azure:healthcare/service:Service example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource_group/providers/Microsoft.HealthcareApis/services/service_name
 * ```
 */
public class Service internal constructor(
    override val javaResource: com.pulumi.azure.healthcare.Service,
) : KotlinCustomResource(javaResource, ServiceMapper) {
    public val accessPolicyObjectIds: Output>?
        get() = javaResource.accessPolicyObjectIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * An `authentication_configuration` block as defined below.
     */
    public val authenticationConfiguration: Output
        get() = javaResource.authenticationConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceAuthenticationConfigurationToKotlin(args0)
            })
        })

    /**
     * Specifies the name of the storage account which the operation configuration information is exported to.
     */
    public val configurationExportStorageAccountName: Output?
        get() = javaResource.configurationExportStorageAccountName().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * A `cors_configuration` block as defined below.
     */
    public val corsConfiguration: Output
        get() = javaResource.corsConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceCorsConfigurationToKotlin(args0)
            })
        })

    /**
     * A versionless Key Vault Key ID for CMK encryption of the backing database. Changing this forces a new resource to be created.
     * > **Please Note** In order to use a `Custom Key` from Key Vault for encryption you must grant Azure Cosmos DB Service access to your key vault. For instructions on how to configure your Key Vault correctly please refer to the [product documentation](https://docs.microsoft.com/azure/cosmos-db/how-to-setup-cmk#add-an-access-policy-to-your-azure-key-vault-instance)
     */
    public val cosmosdbKeyVaultKeyVersionlessId: Output?
        get() = javaResource.cosmosdbKeyVaultKeyVersionlessId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The provisioned throughput for the backing database. Range of `400`-`100000`. Defaults to `1000`.
     */
    public val cosmosdbThroughput: Output?
        get() = javaResource.cosmosdbThroughput().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    serviceIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The type of the service. Values at time of publication are: `fhir`, `fhir-Stu3` and `fhir-R4`. Default value is `fhir`.
     */
    public val kind: Output?
        get() = javaResource.kind().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the supported Azure Region where the Service should be created. Changing this forces a new resource to be created.
     * > **Please Note**: Not all locations support this resource. Some are `West US 2`, `North Central US`, and `UK West`.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name of the service instance. Used for service endpoint, must be unique within the audience. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Whether public network access is enabled or disabled for this service instance. Defaults to `true`.
     */
    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group in which to create the Service. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object ServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.healthcare.Service::class == javaResource::class

    override fun map(javaResource: Resource): Service = Service(
        javaResource as
            com.pulumi.azure.healthcare.Service,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy