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

com.pulumi.azure.mysql.kotlin.ServerKey.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.mysql.kotlin

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

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

    public var args: ServerKeyArgs = ServerKeyArgs()

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

/**
 * Manages a Customer Managed Key for a MySQL Server.
 * > **Note:** Azure Database for MySQL Single Server and its sub resources are scheduled for retirement by 2024-09-16 and will migrate to using Azure Database for MySQL Flexible Server: https://go.microsoft.com/fwlink/?linkid=2216041. The `azure.mysql.ServerKey` resource is deprecated and will be removed in v4.0 of the AzureRM Provider. Please use the `customer_managed_key` property of the `azure.mysql.FlexibleServer` resource instead.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "examplekv",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "premium",
 *     purgeProtectionEnabled: true,
 * });
 * const exampleServer = new azure.mysql.Server("example", {
 *     name: "example-mysql-server",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "GP_Gen5_2",
 *     administratorLogin: "acctestun",
 *     administratorLoginPassword: "H@Sh1CoR3!",
 *     sslEnforcementEnabled: true,
 *     sslMinimalTlsVersionEnforced: "TLS1_1",
 *     storageMb: 51200,
 *     version: "5.7",
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const server = new azure.keyvault.AccessPolicy("server", {
 *     keyVaultId: exampleKeyVault.id,
 *     tenantId: current.then(current => current.tenantId),
 *     objectId: exampleServer.identity.apply(identity => identity?.principalId),
 *     keyPermissions: [
 *         "Get",
 *         "UnwrapKey",
 *         "WrapKey",
 *     ],
 *     secretPermissions: ["Get"],
 * });
 * const client = new azure.keyvault.AccessPolicy("client", {
 *     keyVaultId: exampleKeyVault.id,
 *     tenantId: current.then(current => current.tenantId),
 *     objectId: current.then(current => current.objectId),
 *     keyPermissions: [
 *         "Get",
 *         "Create",
 *         "Delete",
 *         "List",
 *         "Restore",
 *         "Recover",
 *         "UnwrapKey",
 *         "WrapKey",
 *         "Purge",
 *         "Encrypt",
 *         "Decrypt",
 *         "Sign",
 *         "Verify",
 *         "GetRotationPolicy",
 *     ],
 *     secretPermissions: ["Get"],
 * });
 * const exampleKey = new azure.keyvault.Key("example", {
 *     name: "tfex-key",
 *     keyVaultId: exampleKeyVault.id,
 *     keyType: "RSA",
 *     keySize: 2048,
 *     keyOpts: [
 *         "decrypt",
 *         "encrypt",
 *         "sign",
 *         "unwrapKey",
 *         "verify",
 *         "wrapKey",
 *     ],
 * }, {
 *     dependsOn: [
 *         client,
 *         server,
 *     ],
 * });
 * const exampleServerKey = new azure.mysql.ServerKey("example", {
 *     serverId: exampleServer.id,
 *     keyVaultKeyId: exampleKey.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_key_vault = azure.keyvault.KeyVault("example",
 *     name="examplekv",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     tenant_id=current.tenant_id,
 *     sku_name="premium",
 *     purge_protection_enabled=True)
 * example_server = azure.mysql.Server("example",
 *     name="example-mysql-server",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="GP_Gen5_2",
 *     administrator_login="acctestun",
 *     administrator_login_password="H@Sh1CoR3!",
 *     ssl_enforcement_enabled=True,
 *     ssl_minimal_tls_version_enforced="TLS1_1",
 *     storage_mb=51200,
 *     version="5.7",
 *     identity={
 *         "type": "SystemAssigned",
 *     })
 * server = azure.keyvault.AccessPolicy("server",
 *     key_vault_id=example_key_vault.id,
 *     tenant_id=current.tenant_id,
 *     object_id=example_server.identity.principal_id,
 *     key_permissions=[
 *         "Get",
 *         "UnwrapKey",
 *         "WrapKey",
 *     ],
 *     secret_permissions=["Get"])
 * client = azure.keyvault.AccessPolicy("client",
 *     key_vault_id=example_key_vault.id,
 *     tenant_id=current.tenant_id,
 *     object_id=current.object_id,
 *     key_permissions=[
 *         "Get",
 *         "Create",
 *         "Delete",
 *         "List",
 *         "Restore",
 *         "Recover",
 *         "UnwrapKey",
 *         "WrapKey",
 *         "Purge",
 *         "Encrypt",
 *         "Decrypt",
 *         "Sign",
 *         "Verify",
 *         "GetRotationPolicy",
 *     ],
 *     secret_permissions=["Get"])
 * example_key = azure.keyvault.Key("example",
 *     name="tfex-key",
 *     key_vault_id=example_key_vault.id,
 *     key_type="RSA",
 *     key_size=2048,
 *     key_opts=[
 *         "decrypt",
 *         "encrypt",
 *         "sign",
 *         "unwrapKey",
 *         "verify",
 *         "wrapKey",
 *     ],
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             client,
 *             server,
 *         ]))
 * example_server_key = azure.mysql.ServerKey("example",
 *     server_id=example_server.id,
 *     key_vault_key_id=example_key.id)
 * ```
 * ```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.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
 *     {
 *         Name = "examplekv",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         SkuName = "premium",
 *         PurgeProtectionEnabled = true,
 *     });
 *     var exampleServer = new Azure.MySql.Server("example", new()
 *     {
 *         Name = "example-mysql-server",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "GP_Gen5_2",
 *         AdministratorLogin = "acctestun",
 *         AdministratorLoginPassword = "H@Sh1CoR3!",
 *         SslEnforcementEnabled = true,
 *         SslMinimalTlsVersionEnforced = "TLS1_1",
 *         StorageMb = 51200,
 *         Version = "5.7",
 *         Identity = new Azure.MySql.Inputs.ServerIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *     });
 *     var server = new Azure.KeyVault.AccessPolicy("server", new()
 *     {
 *         KeyVaultId = exampleKeyVault.Id,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         ObjectId = exampleServer.Identity.Apply(identity => identity?.PrincipalId),
 *         KeyPermissions = new[]
 *         {
 *             "Get",
 *             "UnwrapKey",
 *             "WrapKey",
 *         },
 *         SecretPermissions = new[]
 *         {
 *             "Get",
 *         },
 *     });
 *     var client = new Azure.KeyVault.AccessPolicy("client", new()
 *     {
 *         KeyVaultId = exampleKeyVault.Id,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *         KeyPermissions = new[]
 *         {
 *             "Get",
 *             "Create",
 *             "Delete",
 *             "List",
 *             "Restore",
 *             "Recover",
 *             "UnwrapKey",
 *             "WrapKey",
 *             "Purge",
 *             "Encrypt",
 *             "Decrypt",
 *             "Sign",
 *             "Verify",
 *             "GetRotationPolicy",
 *         },
 *         SecretPermissions = new[]
 *         {
 *             "Get",
 *         },
 *     });
 *     var exampleKey = new Azure.KeyVault.Key("example", new()
 *     {
 *         Name = "tfex-key",
 *         KeyVaultId = exampleKeyVault.Id,
 *         KeyType = "RSA",
 *         KeySize = 2048,
 *         KeyOpts = new[]
 *         {
 *             "decrypt",
 *             "encrypt",
 *             "sign",
 *             "unwrapKey",
 *             "verify",
 *             "wrapKey",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             client,
 *             server,
 *         },
 *     });
 *     var exampleServerKey = new Azure.MySql.ServerKey("example", new()
 *     {
 *         ServerId = exampleServer.Id,
 *         KeyVaultKeyId = exampleKey.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mysql"
 * 	"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
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
 * 			Name:                   pulumi.String("examplekv"),
 * 			Location:               example.Location,
 * 			ResourceGroupName:      example.Name,
 * 			TenantId:               pulumi.String(current.TenantId),
 * 			SkuName:                pulumi.String("premium"),
 * 			PurgeProtectionEnabled: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := mysql.NewServer(ctx, "example", &mysql.ServerArgs{
 * 			Name:                         pulumi.String("example-mysql-server"),
 * 			Location:                     example.Location,
 * 			ResourceGroupName:            example.Name,
 * 			SkuName:                      pulumi.String("GP_Gen5_2"),
 * 			AdministratorLogin:           pulumi.String("acctestun"),
 * 			AdministratorLoginPassword:   pulumi.String("H@Sh1CoR3!"),
 * 			SslEnforcementEnabled:        pulumi.Bool(true),
 * 			SslMinimalTlsVersionEnforced: pulumi.String("TLS1_1"),
 * 			StorageMb:                    pulumi.Int(51200),
 * 			Version:                      pulumi.String("5.7"),
 * 			Identity: &mysql.ServerIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		server, err := keyvault.NewAccessPolicy(ctx, "server", &keyvault.AccessPolicyArgs{
 * 			KeyVaultId: exampleKeyVault.ID(),
 * 			TenantId:   pulumi.String(current.TenantId),
 * 			ObjectId: pulumi.String(exampleServer.Identity.ApplyT(func(identity mysql.ServerIdentity) (*string, error) {
 * 				return &identity.PrincipalId, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			KeyPermissions: pulumi.StringArray{
 * 				pulumi.String("Get"),
 * 				pulumi.String("UnwrapKey"),
 * 				pulumi.String("WrapKey"),
 * 			},
 * 			SecretPermissions: pulumi.StringArray{
 * 				pulumi.String("Get"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		client, err := keyvault.NewAccessPolicy(ctx, "client", &keyvault.AccessPolicyArgs{
 * 			KeyVaultId: exampleKeyVault.ID(),
 * 			TenantId:   pulumi.String(current.TenantId),
 * 			ObjectId:   pulumi.String(current.ObjectId),
 * 			KeyPermissions: pulumi.StringArray{
 * 				pulumi.String("Get"),
 * 				pulumi.String("Create"),
 * 				pulumi.String("Delete"),
 * 				pulumi.String("List"),
 * 				pulumi.String("Restore"),
 * 				pulumi.String("Recover"),
 * 				pulumi.String("UnwrapKey"),
 * 				pulumi.String("WrapKey"),
 * 				pulumi.String("Purge"),
 * 				pulumi.String("Encrypt"),
 * 				pulumi.String("Decrypt"),
 * 				pulumi.String("Sign"),
 * 				pulumi.String("Verify"),
 * 				pulumi.String("GetRotationPolicy"),
 * 			},
 * 			SecretPermissions: pulumi.StringArray{
 * 				pulumi.String("Get"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKey, err := keyvault.NewKey(ctx, "example", &keyvault.KeyArgs{
 * 			Name:       pulumi.String("tfex-key"),
 * 			KeyVaultId: exampleKeyVault.ID(),
 * 			KeyType:    pulumi.String("RSA"),
 * 			KeySize:    pulumi.Int(2048),
 * 			KeyOpts: pulumi.StringArray{
 * 				pulumi.String("decrypt"),
 * 				pulumi.String("encrypt"),
 * 				pulumi.String("sign"),
 * 				pulumi.String("unwrapKey"),
 * 				pulumi.String("verify"),
 * 				pulumi.String("wrapKey"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			client,
 * 			server,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mysql.NewServerKey(ctx, "example", &mysql.ServerKeyArgs{
 * 			ServerId:      exampleServer.ID(),
 * 			KeyVaultKeyId: exampleKey.ID(),
 * 		})
 * 		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.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.keyvault.KeyVault;
 * import com.pulumi.azure.keyvault.KeyVaultArgs;
 * import com.pulumi.azure.mysql.Server;
 * import com.pulumi.azure.mysql.ServerArgs;
 * import com.pulumi.azure.mysql.inputs.ServerIdentityArgs;
 * import com.pulumi.azure.keyvault.AccessPolicy;
 * import com.pulumi.azure.keyvault.AccessPolicyArgs;
 * import com.pulumi.azure.keyvault.Key;
 * import com.pulumi.azure.keyvault.KeyArgs;
 * import com.pulumi.azure.mysql.ServerKey;
 * import com.pulumi.azure.mysql.ServerKeyArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
 *             .name("examplekv")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .skuName("premium")
 *             .purgeProtectionEnabled(true)
 *             .build());
 *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
 *             .name("example-mysql-server")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("GP_Gen5_2")
 *             .administratorLogin("acctestun")
 *             .administratorLoginPassword("H@Sh1CoR3!")
 *             .sslEnforcementEnabled(true)
 *             .sslMinimalTlsVersionEnforced("TLS1_1")
 *             .storageMb(51200)
 *             .version("5.7")
 *             .identity(ServerIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *         var server = new AccessPolicy("server", AccessPolicyArgs.builder()
 *             .keyVaultId(exampleKeyVault.id())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .objectId(exampleServer.identity().applyValue(identity -> identity.principalId()))
 *             .keyPermissions(
 *                 "Get",
 *                 "UnwrapKey",
 *                 "WrapKey")
 *             .secretPermissions("Get")
 *             .build());
 *         var client = new AccessPolicy("client", AccessPolicyArgs.builder()
 *             .keyVaultId(exampleKeyVault.id())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .keyPermissions(
 *                 "Get",
 *                 "Create",
 *                 "Delete",
 *                 "List",
 *                 "Restore",
 *                 "Recover",
 *                 "UnwrapKey",
 *                 "WrapKey",
 *                 "Purge",
 *                 "Encrypt",
 *                 "Decrypt",
 *                 "Sign",
 *                 "Verify",
 *                 "GetRotationPolicy")
 *             .secretPermissions("Get")
 *             .build());
 *         var exampleKey = new Key("exampleKey", KeyArgs.builder()
 *             .name("tfex-key")
 *             .keyVaultId(exampleKeyVault.id())
 *             .keyType("RSA")
 *             .keySize(2048)
 *             .keyOpts(
 *                 "decrypt",
 *                 "encrypt",
 *                 "sign",
 *                 "unwrapKey",
 *                 "verify",
 *                 "wrapKey")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     client,
 *                     server)
 *                 .build());
 *         var exampleServerKey = new ServerKey("exampleServerKey", ServerKeyArgs.builder()
 *             .serverId(exampleServer.id())
 *             .keyVaultKeyId(exampleKey.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleKeyVault:
 *     type: azure:keyvault:KeyVault
 *     name: example
 *     properties:
 *       name: examplekv
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       tenantId: ${current.tenantId}
 *       skuName: premium
 *       purgeProtectionEnabled: true
 *   server:
 *     type: azure:keyvault:AccessPolicy
 *     properties:
 *       keyVaultId: ${exampleKeyVault.id}
 *       tenantId: ${current.tenantId}
 *       objectId: ${exampleServer.identity.principalId}
 *       keyPermissions:
 *         - Get
 *         - UnwrapKey
 *         - WrapKey
 *       secretPermissions:
 *         - Get
 *   client:
 *     type: azure:keyvault:AccessPolicy
 *     properties:
 *       keyVaultId: ${exampleKeyVault.id}
 *       tenantId: ${current.tenantId}
 *       objectId: ${current.objectId}
 *       keyPermissions:
 *         - Get
 *         - Create
 *         - Delete
 *         - List
 *         - Restore
 *         - Recover
 *         - UnwrapKey
 *         - WrapKey
 *         - Purge
 *         - Encrypt
 *         - Decrypt
 *         - Sign
 *         - Verify
 *         - GetRotationPolicy
 *       secretPermissions:
 *         - Get
 *   exampleKey:
 *     type: azure:keyvault:Key
 *     name: example
 *     properties:
 *       name: tfex-key
 *       keyVaultId: ${exampleKeyVault.id}
 *       keyType: RSA
 *       keySize: 2048
 *       keyOpts:
 *         - decrypt
 *         - encrypt
 *         - sign
 *         - unwrapKey
 *         - verify
 *         - wrapKey
 *     options:
 *       dependson:
 *         - ${client}
 *         - ${server}
 *   exampleServer:
 *     type: azure:mysql:Server
 *     name: example
 *     properties:
 *       name: example-mysql-server
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: GP_Gen5_2
 *       administratorLogin: acctestun
 *       administratorLoginPassword: H@Sh1CoR3!
 *       sslEnforcementEnabled: true
 *       sslMinimalTlsVersionEnforced: TLS1_1
 *       storageMb: 51200
 *       version: '5.7'
 *       identity:
 *         type: SystemAssigned
 *   exampleServerKey:
 *     type: azure:mysql:ServerKey
 *     name: example
 *     properties:
 *       serverId: ${exampleServer.id}
 *       keyVaultKeyId: ${exampleKey.id}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * A MySQL Server Key can be imported using the `resource id` of the MySQL Server Key, e.g.
 * ```sh
 * $ pulumi import azure:mysql/serverKey:ServerKey example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DBforMySQL/servers/server1/keys/keyvaultname_key-name_keyversion
 * ```
 */
public class ServerKey internal constructor(
    override val javaResource: com.pulumi.azure.mysql.ServerKey,
) : KotlinCustomResource(javaResource, ServerKeyMapper) {
    /**
     * The URL to a Key Vault Key.
     */
    public val keyVaultKeyId: Output
        get() = javaResource.keyVaultKeyId().applyValue({ args0 -> args0 })

    /**
     * The ID of the MySQL Server. Changing this forces a new resource to be created.
     */
    public val serverId: Output
        get() = javaResource.serverId().applyValue({ args0 -> args0 })
}

public object ServerKeyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mysql.ServerKey::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy