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

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

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

package com.pulumi.azure.mysql.kotlin

import com.pulumi.azure.mysql.MysqlFunctions.getFlexibleServerPlain
import com.pulumi.azure.mysql.MysqlFunctions.getServerPlain
import com.pulumi.azure.mysql.kotlin.inputs.GetFlexibleServerPlainArgs
import com.pulumi.azure.mysql.kotlin.inputs.GetFlexibleServerPlainArgsBuilder
import com.pulumi.azure.mysql.kotlin.inputs.GetServerPlainArgs
import com.pulumi.azure.mysql.kotlin.inputs.GetServerPlainArgsBuilder
import com.pulumi.azure.mysql.kotlin.outputs.GetFlexibleServerResult
import com.pulumi.azure.mysql.kotlin.outputs.GetServerResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.azure.mysql.kotlin.outputs.GetFlexibleServerResult.Companion.toKotlin as getFlexibleServerResultToKotlin
import com.pulumi.azure.mysql.kotlin.outputs.GetServerResult.Companion.toKotlin as getServerResultToKotlin

public object MysqlFunctions {
    /**
     * Use this data source to access information about an existing MySQL Flexible Server.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.mysql.getFlexibleServer({
     *     name: "existingMySqlFlexibleServer",
     *     resourceGroupName: "existingResGroup",
     * });
     * export const id = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.mysql.get_flexible_server(name="existingMySqlFlexibleServer",
     *     resource_group_name="existingResGroup")
     * pulumi.export("id", example.id)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = Azure.MySql.GetFlexibleServer.Invoke(new()
     *     {
     *         Name = "existingMySqlFlexibleServer",
     *         ResourceGroupName = "existingResGroup",
     *     });
     *     return new Dictionary
     *     {
     *         ["id"] = example.Apply(getFlexibleServerResult => getFlexibleServerResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"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 := mysql.LookupFlexibleServer(ctx, &mysql.LookupFlexibleServerArgs{
     * 			Name:              "existingMySqlFlexibleServer",
     * 			ResourceGroupName: "existingResGroup",
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		ctx.Export("id", example.Id)
     * 		return nil
     * 	})
     * }
     * ```
     * ```java
     * package generated_program;
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.azure.mysql.MysqlFunctions;
     * import com.pulumi.azure.mysql.inputs.GetFlexibleServerArgs;
     * 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 example = MysqlFunctions.getFlexibleServer(GetFlexibleServerArgs.builder()
     *             .name("existingMySqlFlexibleServer")
     *             .resourceGroupName("existingResGroup")
     *             .build());
     *         ctx.export("id", example.applyValue(getFlexibleServerResult -> getFlexibleServerResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mysql:getFlexibleServer
     *       Arguments:
     *         name: existingMySqlFlexibleServer
     *         resourceGroupName: existingResGroup
     * outputs:
     *   id: ${example.id}
     * ```
     * 
     * @param argument A collection of arguments for invoking getFlexibleServer.
     * @return A collection of values returned by getFlexibleServer.
     */
    public suspend fun getFlexibleServer(argument: GetFlexibleServerPlainArgs): GetFlexibleServerResult =
        getFlexibleServerResultToKotlin(getFlexibleServerPlain(argument.toJava()).await())

    /**
     * @see [getFlexibleServer].
     * @param name Specifies the name of the MySQL Flexible Server.
     * @param resourceGroupName The name of the resource group for the MySQL Flexible Server.
     * @return A collection of values returned by getFlexibleServer.
     */
    public suspend fun getFlexibleServer(name: String, resourceGroupName: String): GetFlexibleServerResult {
        val argument = GetFlexibleServerPlainArgs(
            name = name,
            resourceGroupName = resourceGroupName,
        )
        return getFlexibleServerResultToKotlin(getFlexibleServerPlain(argument.toJava()).await())
    }

    /**
     * @see [getFlexibleServer].
     * @param argument Builder for [com.pulumi.azure.mysql.kotlin.inputs.GetFlexibleServerPlainArgs].
     * @return A collection of values returned by getFlexibleServer.
     */
    public suspend fun getFlexibleServer(argument: suspend GetFlexibleServerPlainArgsBuilder.() -> Unit): GetFlexibleServerResult {
        val builder = GetFlexibleServerPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getFlexibleServerResultToKotlin(getFlexibleServerPlain(builtArgument.toJava()).await())
    }

    /**
     * Use this data source to access information about an existing 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.Server` data source is deprecated and will be removed in v4.0 of the AzureRM Provider. Please use the `azure.mysql.FlexibleServer` data source instead.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.mysql.getServer({
     *     name: "existingMySqlServer",
     *     resourceGroupName: "existingResGroup",
     * });
     * export const id = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.mysql.get_server(name="existingMySqlServer",
     *     resource_group_name="existingResGroup")
     * pulumi.export("id", example.id)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = Azure.MySql.GetServer.Invoke(new()
     *     {
     *         Name = "existingMySqlServer",
     *         ResourceGroupName = "existingResGroup",
     *     });
     *     return new Dictionary
     *     {
     *         ["id"] = example.Apply(getServerResult => getServerResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"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 := mysql.LookupServer(ctx, &mysql.LookupServerArgs{
     * 			Name:              "existingMySqlServer",
     * 			ResourceGroupName: "existingResGroup",
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		ctx.Export("id", example.Id)
     * 		return nil
     * 	})
     * }
     * ```
     * ```java
     * package generated_program;
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.azure.mysql.MysqlFunctions;
     * import com.pulumi.azure.mysql.inputs.GetServerArgs;
     * 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 example = MysqlFunctions.getServer(GetServerArgs.builder()
     *             .name("existingMySqlServer")
     *             .resourceGroupName("existingResGroup")
     *             .build());
     *         ctx.export("id", example.applyValue(getServerResult -> getServerResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mysql:getServer
     *       Arguments:
     *         name: existingMySqlServer
     *         resourceGroupName: existingResGroup
     * outputs:
     *   id: ${example.id}
     * ```
     * 
     * @param argument A collection of arguments for invoking getServer.
     * @return A collection of values returned by getServer.
     */
    public suspend fun getServer(argument: GetServerPlainArgs): GetServerResult =
        getServerResultToKotlin(getServerPlain(argument.toJava()).await())

    /**
     * @see [getServer].
     * @param name Specifies the name of the MySQL Server.
     * @param resourceGroupName The name of the resource group for the MySQL Server.
     * @return A collection of values returned by getServer.
     */
    public suspend fun getServer(name: String, resourceGroupName: String): GetServerResult {
        val argument = GetServerPlainArgs(
            name = name,
            resourceGroupName = resourceGroupName,
        )
        return getServerResultToKotlin(getServerPlain(argument.toJava()).await())
    }

    /**
     * @see [getServer].
     * @param argument Builder for [com.pulumi.azure.mysql.kotlin.inputs.GetServerPlainArgs].
     * @return A collection of values returned by getServer.
     */
    public suspend fun getServer(argument: suspend GetServerPlainArgsBuilder.() -> Unit): GetServerResult {
        val builder = GetServerPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getServerResultToKotlin(getServerPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy