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

com.pulumi.azure.appplatform.kotlin.SpringCloudAppMysqlAssociation.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appplatform.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 [SpringCloudAppMysqlAssociation].
 */
@PulumiTagMarker
public class SpringCloudAppMysqlAssociationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SpringCloudAppMysqlAssociationArgs = SpringCloudAppMysqlAssociationArgs()

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

/**
 * Associates a Spring Cloud Application with a MySQL Database.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleSpringCloudService = new azure.appplatform.SpringCloudService("example", {
 *     name: "example-springcloud",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleSpringCloudApp = new azure.appplatform.SpringCloudApp("example", {
 *     name: "example-springcloudapp",
 *     resourceGroupName: example.name,
 *     serviceName: exampleSpringCloudService.name,
 * });
 * const exampleServer = new azure.mysql.Server("example", {
 *     name: "example-mysqlserver",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     administratorLogin: "mysqladminun",
 *     administratorLoginPassword: "H@Sh1CoR3!",
 *     skuName: "B_Gen5_2",
 *     storageMb: 5120,
 *     version: "5.7",
 *     sslEnforcementEnabled: true,
 *     sslMinimalTlsVersionEnforced: "TLS1_2",
 * });
 * const exampleDatabase = new azure.mysql.Database("example", {
 *     name: "exampledb",
 *     resourceGroupName: example.name,
 *     serverName: exampleServer.name,
 *     charset: "utf8",
 *     collation: "utf8_unicode_ci",
 * });
 * const exampleSpringCloudAppMysqlAssociation = new azure.appplatform.SpringCloudAppMysqlAssociation("example", {
 *     name: "example-bind",
 *     springCloudAppId: exampleSpringCloudApp.id,
 *     mysqlServerId: exampleServer.id,
 *     databaseName: exampleDatabase.name,
 *     username: exampleServer.administratorLogin,
 *     password: exampleServer.administratorLoginPassword,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_spring_cloud_service = azure.appplatform.SpringCloudService("example",
 *     name="example-springcloud",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_spring_cloud_app = azure.appplatform.SpringCloudApp("example",
 *     name="example-springcloudapp",
 *     resource_group_name=example.name,
 *     service_name=example_spring_cloud_service.name)
 * example_server = azure.mysql.Server("example",
 *     name="example-mysqlserver",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     administrator_login="mysqladminun",
 *     administrator_login_password="H@Sh1CoR3!",
 *     sku_name="B_Gen5_2",
 *     storage_mb=5120,
 *     version="5.7",
 *     ssl_enforcement_enabled=True,
 *     ssl_minimal_tls_version_enforced="TLS1_2")
 * example_database = azure.mysql.Database("example",
 *     name="exampledb",
 *     resource_group_name=example.name,
 *     server_name=example_server.name,
 *     charset="utf8",
 *     collation="utf8_unicode_ci")
 * example_spring_cloud_app_mysql_association = azure.appplatform.SpringCloudAppMysqlAssociation("example",
 *     name="example-bind",
 *     spring_cloud_app_id=example_spring_cloud_app.id,
 *     mysql_server_id=example_server.id,
 *     database_name=example_database.name,
 *     username=example_server.administrator_login,
 *     password=example_server.administrator_login_password)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleSpringCloudService = new Azure.AppPlatform.SpringCloudService("example", new()
 *     {
 *         Name = "example-springcloud",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleSpringCloudApp = new Azure.AppPlatform.SpringCloudApp("example", new()
 *     {
 *         Name = "example-springcloudapp",
 *         ResourceGroupName = example.Name,
 *         ServiceName = exampleSpringCloudService.Name,
 *     });
 *     var exampleServer = new Azure.MySql.Server("example", new()
 *     {
 *         Name = "example-mysqlserver",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AdministratorLogin = "mysqladminun",
 *         AdministratorLoginPassword = "H@Sh1CoR3!",
 *         SkuName = "B_Gen5_2",
 *         StorageMb = 5120,
 *         Version = "5.7",
 *         SslEnforcementEnabled = true,
 *         SslMinimalTlsVersionEnforced = "TLS1_2",
 *     });
 *     var exampleDatabase = new Azure.MySql.Database("example", new()
 *     {
 *         Name = "exampledb",
 *         ResourceGroupName = example.Name,
 *         ServerName = exampleServer.Name,
 *         Charset = "utf8",
 *         Collation = "utf8_unicode_ci",
 *     });
 *     var exampleSpringCloudAppMysqlAssociation = new Azure.AppPlatform.SpringCloudAppMysqlAssociation("example", new()
 *     {
 *         Name = "example-bind",
 *         SpringCloudAppId = exampleSpringCloudApp.Id,
 *         MysqlServerId = exampleServer.Id,
 *         DatabaseName = exampleDatabase.Name,
 *         Username = exampleServer.AdministratorLogin,
 *         Password = exampleServer.AdministratorLoginPassword,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appplatform"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"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 {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSpringCloudService, err := appplatform.NewSpringCloudService(ctx, "example", &appplatform.SpringCloudServiceArgs{
 * 			Name:              pulumi.String("example-springcloud"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSpringCloudApp, err := appplatform.NewSpringCloudApp(ctx, "example", &appplatform.SpringCloudAppArgs{
 * 			Name:              pulumi.String("example-springcloudapp"),
 * 			ResourceGroupName: example.Name,
 * 			ServiceName:       exampleSpringCloudService.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := mysql.NewServer(ctx, "example", &mysql.ServerArgs{
 * 			Name:                         pulumi.String("example-mysqlserver"),
 * 			Location:                     example.Location,
 * 			ResourceGroupName:            example.Name,
 * 			AdministratorLogin:           pulumi.String("mysqladminun"),
 * 			AdministratorLoginPassword:   pulumi.String("H@Sh1CoR3!"),
 * 			SkuName:                      pulumi.String("B_Gen5_2"),
 * 			StorageMb:                    pulumi.Int(5120),
 * 			Version:                      pulumi.String("5.7"),
 * 			SslEnforcementEnabled:        pulumi.Bool(true),
 * 			SslMinimalTlsVersionEnforced: pulumi.String("TLS1_2"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDatabase, err := mysql.NewDatabase(ctx, "example", &mysql.DatabaseArgs{
 * 			Name:              pulumi.String("exampledb"),
 * 			ResourceGroupName: example.Name,
 * 			ServerName:        exampleServer.Name,
 * 			Charset:           pulumi.String("utf8"),
 * 			Collation:         pulumi.String("utf8_unicode_ci"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appplatform.NewSpringCloudAppMysqlAssociation(ctx, "example", &appplatform.SpringCloudAppMysqlAssociationArgs{
 * 			Name:             pulumi.String("example-bind"),
 * 			SpringCloudAppId: exampleSpringCloudApp.ID(),
 * 			MysqlServerId:    exampleServer.ID(),
 * 			DatabaseName:     exampleDatabase.Name,
 * 			Username:         exampleServer.AdministratorLogin,
 * 			Password:         exampleServer.AdministratorLoginPassword,
 * 		})
 * 		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.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.appplatform.SpringCloudService;
 * import com.pulumi.azure.appplatform.SpringCloudServiceArgs;
 * import com.pulumi.azure.appplatform.SpringCloudApp;
 * import com.pulumi.azure.appplatform.SpringCloudAppArgs;
 * import com.pulumi.azure.mysql.Server;
 * import com.pulumi.azure.mysql.ServerArgs;
 * import com.pulumi.azure.mysql.Database;
 * import com.pulumi.azure.mysql.DatabaseArgs;
 * import com.pulumi.azure.appplatform.SpringCloudAppMysqlAssociation;
 * import com.pulumi.azure.appplatform.SpringCloudAppMysqlAssociationArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleSpringCloudService = new SpringCloudService("exampleSpringCloudService", SpringCloudServiceArgs.builder()
 *             .name("example-springcloud")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleSpringCloudApp = new SpringCloudApp("exampleSpringCloudApp", SpringCloudAppArgs.builder()
 *             .name("example-springcloudapp")
 *             .resourceGroupName(example.name())
 *             .serviceName(exampleSpringCloudService.name())
 *             .build());
 *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
 *             .name("example-mysqlserver")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .administratorLogin("mysqladminun")
 *             .administratorLoginPassword("H@Sh1CoR3!")
 *             .skuName("B_Gen5_2")
 *             .storageMb(5120)
 *             .version("5.7")
 *             .sslEnforcementEnabled(true)
 *             .sslMinimalTlsVersionEnforced("TLS1_2")
 *             .build());
 *         var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
 *             .name("exampledb")
 *             .resourceGroupName(example.name())
 *             .serverName(exampleServer.name())
 *             .charset("utf8")
 *             .collation("utf8_unicode_ci")
 *             .build());
 *         var exampleSpringCloudAppMysqlAssociation = new SpringCloudAppMysqlAssociation("exampleSpringCloudAppMysqlAssociation", SpringCloudAppMysqlAssociationArgs.builder()
 *             .name("example-bind")
 *             .springCloudAppId(exampleSpringCloudApp.id())
 *             .mysqlServerId(exampleServer.id())
 *             .databaseName(exampleDatabase.name())
 *             .username(exampleServer.administratorLogin())
 *             .password(exampleServer.administratorLoginPassword())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleSpringCloudService:
 *     type: azure:appplatform:SpringCloudService
 *     name: example
 *     properties:
 *       name: example-springcloud
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleSpringCloudApp:
 *     type: azure:appplatform:SpringCloudApp
 *     name: example
 *     properties:
 *       name: example-springcloudapp
 *       resourceGroupName: ${example.name}
 *       serviceName: ${exampleSpringCloudService.name}
 *   exampleServer:
 *     type: azure:mysql:Server
 *     name: example
 *     properties:
 *       name: example-mysqlserver
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       administratorLogin: mysqladminun
 *       administratorLoginPassword: H@Sh1CoR3!
 *       skuName: B_Gen5_2
 *       storageMb: 5120
 *       version: '5.7'
 *       sslEnforcementEnabled: true
 *       sslMinimalTlsVersionEnforced: TLS1_2
 *   exampleDatabase:
 *     type: azure:mysql:Database
 *     name: example
 *     properties:
 *       name: exampledb
 *       resourceGroupName: ${example.name}
 *       serverName: ${exampleServer.name}
 *       charset: utf8
 *       collation: utf8_unicode_ci
 *   exampleSpringCloudAppMysqlAssociation:
 *     type: azure:appplatform:SpringCloudAppMysqlAssociation
 *     name: example
 *     properties:
 *       name: example-bind
 *       springCloudAppId: ${exampleSpringCloudApp.id}
 *       mysqlServerId: ${exampleServer.id}
 *       databaseName: ${exampleDatabase.name}
 *       username: ${exampleServer.administratorLogin}
 *       password: ${exampleServer.administratorLoginPassword}
 * ```
 * 
 * ## Import
 * Spring Cloud Application MySQL Association can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appplatform/springCloudAppMysqlAssociation:SpringCloudAppMysqlAssociation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.AppPlatform/spring/service1/apps/app1/bindings/bind1
 * ```
 */
public class SpringCloudAppMysqlAssociation internal constructor(
    override val javaResource: com.pulumi.azure.appplatform.SpringCloudAppMysqlAssociation,
) : KotlinCustomResource(javaResource, SpringCloudAppMysqlAssociationMapper) {
    /**
     * Specifies the name of the MySQL Database which the Spring Cloud App should be associated with.
     */
    public val databaseName: Output
        get() = javaResource.databaseName().applyValue({ args0 -> args0 })

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

    /**
     * Specifies the name of the Spring Cloud Application Association. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the password which should be used when connecting to the MySQL Database from the Spring Cloud App.
     */
    public val password: Output
        get() = javaResource.password().applyValue({ args0 -> args0 })

    /**
     * Specifies the ID of the Spring Cloud Application where this Association is created. Changing this forces a new resource to be created.
     */
    public val springCloudAppId: Output
        get() = javaResource.springCloudAppId().applyValue({ args0 -> args0 })

    /**
     * Specifies the username which should be used when connecting to the MySQL Database from the Spring Cloud App.
     */
    public val username: Output
        get() = javaResource.username().applyValue({ args0 -> args0 })
}

public object SpringCloudAppMysqlAssociationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appplatform.SpringCloudAppMysqlAssociation::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy