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

com.pulumi.azure.mssql.kotlin.MssqlFunctions.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.mssql.kotlin

import com.pulumi.azure.mssql.MssqlFunctions.getDatabasePlain
import com.pulumi.azure.mssql.MssqlFunctions.getElasticPoolPlain
import com.pulumi.azure.mssql.MssqlFunctions.getManagedInstancePlain
import com.pulumi.azure.mssql.MssqlFunctions.getServerPlain
import com.pulumi.azure.mssql.kotlin.inputs.GetDatabasePlainArgs
import com.pulumi.azure.mssql.kotlin.inputs.GetDatabasePlainArgsBuilder
import com.pulumi.azure.mssql.kotlin.inputs.GetElasticPoolPlainArgs
import com.pulumi.azure.mssql.kotlin.inputs.GetElasticPoolPlainArgsBuilder
import com.pulumi.azure.mssql.kotlin.inputs.GetManagedInstancePlainArgs
import com.pulumi.azure.mssql.kotlin.inputs.GetManagedInstancePlainArgsBuilder
import com.pulumi.azure.mssql.kotlin.inputs.GetServerPlainArgs
import com.pulumi.azure.mssql.kotlin.inputs.GetServerPlainArgsBuilder
import com.pulumi.azure.mssql.kotlin.outputs.GetDatabaseResult
import com.pulumi.azure.mssql.kotlin.outputs.GetElasticPoolResult
import com.pulumi.azure.mssql.kotlin.outputs.GetManagedInstanceResult
import com.pulumi.azure.mssql.kotlin.outputs.GetServerResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.azure.mssql.kotlin.outputs.GetDatabaseResult.Companion.toKotlin as getDatabaseResultToKotlin
import com.pulumi.azure.mssql.kotlin.outputs.GetElasticPoolResult.Companion.toKotlin as getElasticPoolResultToKotlin
import com.pulumi.azure.mssql.kotlin.outputs.GetManagedInstanceResult.Companion.toKotlin as getManagedInstanceResultToKotlin
import com.pulumi.azure.mssql.kotlin.outputs.GetServerResult.Companion.toKotlin as getServerResultToKotlin

public object MssqlFunctions {
    /**
     * Use this data source to access information about an existing SQL database.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
     *     name: "example-resources",
     *     location: "West Europe",
     * });
     * const exampleServer = new azure.mssql.Server("example", {
     *     name: "example",
     *     resourceGroupName: exampleResourceGroup.name,
     *     location: exampleResourceGroup.location,
     *     version: "12.0",
     *     administratorLogin: "4dm1n157r470r",
     *     administratorLoginPassword: "4-v3ry-53cr37-p455w0rd",
     * });
     * const example = azure.mssql.getDatabaseOutput({
     *     name: "example-mssql-db",
     *     serverId: exampleServer.id,
     * });
     * export const databaseId = example.apply(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example_resource_group = azure.core.ResourceGroup("example",
     *     name="example-resources",
     *     location="West Europe")
     * example_server = azure.mssql.Server("example",
     *     name="example",
     *     resource_group_name=example_resource_group.name,
     *     location=example_resource_group.location,
     *     version="12.0",
     *     administrator_login="4dm1n157r470r",
     *     administrator_login_password="4-v3ry-53cr37-p455w0rd")
     * example = azure.mssql.get_database_output(name="example-mssql-db",
     *     server_id=example_server.id)
     * pulumi.export("databaseId", example.id)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
     *     {
     *         Name = "example-resources",
     *         Location = "West Europe",
     *     });
     *     var exampleServer = new Azure.MSSql.Server("example", new()
     *     {
     *         Name = "example",
     *         ResourceGroupName = exampleResourceGroup.Name,
     *         Location = exampleResourceGroup.Location,
     *         Version = "12.0",
     *         AdministratorLogin = "4dm1n157r470r",
     *         AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
     *     });
     *     var example = Azure.MSSql.GetDatabase.Invoke(new()
     *     {
     *         Name = "example-mssql-db",
     *         ServerId = exampleServer.Id,
     *     });
     *     return new Dictionary
     *     {
     *         ["databaseId"] = example.Apply(getDatabaseResult => getDatabaseResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
     * 			Name:     pulumi.String("example-resources"),
     * 			Location: pulumi.String("West Europe"),
     * 		})
     * 		if err != nil {
     * 			return err
     * 		}
     * 		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
     * 			Name:                       pulumi.String("example"),
     * 			ResourceGroupName:          exampleResourceGroup.Name,
     * 			Location:                   exampleResourceGroup.Location,
     * 			Version:                    pulumi.String("12.0"),
     * 			AdministratorLogin:         pulumi.String("4dm1n157r470r"),
     * 			AdministratorLoginPassword: pulumi.String("4-v3ry-53cr37-p455w0rd"),
     * 		})
     * 		if err != nil {
     * 			return err
     * 		}
     * 		example := mssql.LookupDatabaseOutput(ctx, mssql.GetDatabaseOutputArgs{
     * 			Name:     pulumi.String("example-mssql-db"),
     * 			ServerId: exampleServer.ID(),
     * 		}, nil)
     * 		ctx.Export("databaseId", example.ApplyT(func(example mssql.GetDatabaseResult) (*string, error) {
     * 			return &example.Id, nil
     * 		}).(pulumi.StringPtrOutput))
     * 		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.mssql.Server;
     * import com.pulumi.azure.mssql.ServerArgs;
     * import com.pulumi.azure.mssql.MssqlFunctions;
     * import com.pulumi.azure.mssql.inputs.GetDatabaseArgs;
     * 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
     *             .name("example-resources")
     *             .location("West Europe")
     *             .build());
     *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
     *             .name("example")
     *             .resourceGroupName(exampleResourceGroup.name())
     *             .location(exampleResourceGroup.location())
     *             .version("12.0")
     *             .administratorLogin("4dm1n157r470r")
     *             .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
     *             .build());
     *         final var example = MssqlFunctions.getDatabase(GetDatabaseArgs.builder()
     *             .name("example-mssql-db")
     *             .serverId(exampleServer.id())
     *             .build());
     *         ctx.export("databaseId", example.applyValue(getDatabaseResult -> getDatabaseResult).applyValue(example -> example.applyValue(getDatabaseResult -> getDatabaseResult.id())));
     *     }
     * }
     * ```
     * ```yaml
     * resources:
     *   exampleResourceGroup:
     *     type: azure:core:ResourceGroup
     *     name: example
     *     properties:
     *       name: example-resources
     *       location: West Europe
     *   exampleServer:
     *     type: azure:mssql:Server
     *     name: example
     *     properties:
     *       name: example
     *       resourceGroupName: ${exampleResourceGroup.name}
     *       location: ${exampleResourceGroup.location}
     *       version: '12.0'
     *       administratorLogin: 4dm1n157r470r
     *       administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mssql:getDatabase
     *       Arguments:
     *         name: example-mssql-db
     *         serverId: ${exampleServer.id}
     * outputs:
     *   databaseId: ${example.id}
     * ```
     * 
     * @param argument A collection of arguments for invoking getDatabase.
     * @return A collection of values returned by getDatabase.
     */
    public suspend fun getDatabase(argument: GetDatabasePlainArgs): GetDatabaseResult =
        getDatabaseResultToKotlin(getDatabasePlain(argument.toJava()).await())

    /**
     * @see [getDatabase].
     * @param name The name of the MS SQL Database.
     * @param serverId The id of the MS SQL Server on which to read the database.
     * @return A collection of values returned by getDatabase.
     */
    public suspend fun getDatabase(name: String, serverId: String): GetDatabaseResult {
        val argument = GetDatabasePlainArgs(
            name = name,
            serverId = serverId,
        )
        return getDatabaseResultToKotlin(getDatabasePlain(argument.toJava()).await())
    }

    /**
     * @see [getDatabase].
     * @param argument Builder for [com.pulumi.azure.mssql.kotlin.inputs.GetDatabasePlainArgs].
     * @return A collection of values returned by getDatabase.
     */
    public suspend fun getDatabase(argument: suspend GetDatabasePlainArgsBuilder.() -> Unit): GetDatabaseResult {
        val builder = GetDatabasePlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getDatabaseResultToKotlin(getDatabasePlain(builtArgument.toJava()).await())
    }

    /**
     * Use this data source to access information about an existing SQL elastic pool.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.mssql.getElasticPool({
     *     name: "mssqlelasticpoolname",
     *     resourceGroupName: "example-resources",
     *     serverName: "example-sql-server",
     * });
     * export const elasticpoolId = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.mssql.get_elastic_pool(name="mssqlelasticpoolname",
     *     resource_group_name="example-resources",
     *     server_name="example-sql-server")
     * pulumi.export("elasticpoolId", example.id)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = Azure.MSSql.GetElasticPool.Invoke(new()
     *     {
     *         Name = "mssqlelasticpoolname",
     *         ResourceGroupName = "example-resources",
     *         ServerName = "example-sql-server",
     *     });
     *     return new Dictionary
     *     {
     *         ["elasticpoolId"] = example.Apply(getElasticPoolResult => getElasticPoolResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		example, err := mssql.LookupElasticPool(ctx, &mssql.LookupElasticPoolArgs{
     * 			Name:              "mssqlelasticpoolname",
     * 			ResourceGroupName: "example-resources",
     * 			ServerName:        "example-sql-server",
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		ctx.Export("elasticpoolId", 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.mssql.MssqlFunctions;
     * import com.pulumi.azure.mssql.inputs.GetElasticPoolArgs;
     * 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 = MssqlFunctions.getElasticPool(GetElasticPoolArgs.builder()
     *             .name("mssqlelasticpoolname")
     *             .resourceGroupName("example-resources")
     *             .serverName("example-sql-server")
     *             .build());
     *         ctx.export("elasticpoolId", example.applyValue(getElasticPoolResult -> getElasticPoolResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mssql:getElasticPool
     *       Arguments:
     *         name: mssqlelasticpoolname
     *         resourceGroupName: example-resources
     *         serverName: example-sql-server
     * outputs:
     *   elasticpoolId: ${example.id}
     * ```
     * 
     * @param argument A collection of arguments for invoking getElasticPool.
     * @return A collection of values returned by getElasticPool.
     */
    public suspend fun getElasticPool(argument: GetElasticPoolPlainArgs): GetElasticPoolResult =
        getElasticPoolResultToKotlin(getElasticPoolPlain(argument.toJava()).await())

    /**
     * @see [getElasticPool].
     * @param name The name of the elastic pool.
     * @param resourceGroupName The name of the resource group which contains the elastic pool.
     * @param serverName The name of the SQL Server which contains the elastic pool.
     * @return A collection of values returned by getElasticPool.
     */
    public suspend fun getElasticPool(
        name: String,
        resourceGroupName: String,
        serverName: String,
    ): GetElasticPoolResult {
        val argument = GetElasticPoolPlainArgs(
            name = name,
            resourceGroupName = resourceGroupName,
            serverName = serverName,
        )
        return getElasticPoolResultToKotlin(getElasticPoolPlain(argument.toJava()).await())
    }

    /**
     * @see [getElasticPool].
     * @param argument Builder for [com.pulumi.azure.mssql.kotlin.inputs.GetElasticPoolPlainArgs].
     * @return A collection of values returned by getElasticPool.
     */
    public suspend fun getElasticPool(argument: suspend GetElasticPoolPlainArgsBuilder.() -> Unit): GetElasticPoolResult {
        val builder = GetElasticPoolPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getElasticPoolResultToKotlin(getElasticPoolPlain(builtArgument.toJava()).await())
    }

    /**
     * Use this data source to access information about an existing Microsoft SQL Azure Managed Instance.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.mssql.getManagedInstance({
     *     name: "managedsqlinstance",
     *     resourceGroupName: exampleAzurermResourceGroup.name,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.mssql.get_managed_instance(name="managedsqlinstance",
     *     resource_group_name=example_azurerm_resource_group["name"])
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = Azure.MSSql.GetManagedInstance.Invoke(new()
     *     {
     *         Name = "managedsqlinstance",
     *         ResourceGroupName = exampleAzurermResourceGroup.Name,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := mssql.LookupManagedInstance(ctx, &mssql.LookupManagedInstanceArgs{
     * 			Name:              "managedsqlinstance",
     * 			ResourceGroupName: exampleAzurermResourceGroup.Name,
     * 		}, nil)
     * 		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.mssql.MssqlFunctions;
     * import com.pulumi.azure.mssql.inputs.GetManagedInstanceArgs;
     * 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 = MssqlFunctions.getManagedInstance(GetManagedInstanceArgs.builder()
     *             .name("managedsqlinstance")
     *             .resourceGroupName(exampleAzurermResourceGroup.name())
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mssql:getManagedInstance
     *       Arguments:
     *         name: managedsqlinstance
     *         resourceGroupName: ${exampleAzurermResourceGroup.name}
     * ```
     * 
     * @param argument A collection of arguments for invoking getManagedInstance.
     * @return A collection of values returned by getManagedInstance.
     */
    public suspend fun getManagedInstance(argument: GetManagedInstancePlainArgs): GetManagedInstanceResult =
        getManagedInstanceResultToKotlin(getManagedInstancePlain(argument.toJava()).await())

    /**
     * @see [getManagedInstance].
     * @param name The name of the SQL Managed Instance.
     * @param resourceGroupName The name of the resource group where the SQL Managed Instance exists.
     * @return A collection of values returned by getManagedInstance.
     */
    public suspend fun getManagedInstance(name: String, resourceGroupName: String): GetManagedInstanceResult {
        val argument = GetManagedInstancePlainArgs(
            name = name,
            resourceGroupName = resourceGroupName,
        )
        return getManagedInstanceResultToKotlin(getManagedInstancePlain(argument.toJava()).await())
    }

    /**
     * @see [getManagedInstance].
     * @param argument Builder for [com.pulumi.azure.mssql.kotlin.inputs.GetManagedInstancePlainArgs].
     * @return A collection of values returned by getManagedInstance.
     */
    public suspend fun getManagedInstance(argument: suspend GetManagedInstancePlainArgsBuilder.() -> Unit): GetManagedInstanceResult {
        val builder = GetManagedInstancePlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getManagedInstanceResultToKotlin(getManagedInstancePlain(builtArgument.toJava()).await())
    }

    /**
     * Use this data source to access information about an existing Microsoft SQL Server.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.mssql.getServer({
     *     name: "existingMsSqlServer",
     *     resourceGroupName: "existingResGroup",
     * });
     * export const id = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.mssql.get_server(name="existingMsSqlServer",
     *     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.MSSql.GetServer.Invoke(new()
     *     {
     *         Name = "existingMsSqlServer",
     *         ResourceGroupName = "existingResGroup",
     *     });
     *     return new Dictionary
     *     {
     *         ["id"] = example.Apply(getServerResult => getServerResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		example, err := mssql.LookupServer(ctx, &mssql.LookupServerArgs{
     * 			Name:              "existingMsSqlServer",
     * 			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.mssql.MssqlFunctions;
     * import com.pulumi.azure.mssql.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 = MssqlFunctions.getServer(GetServerArgs.builder()
     *             .name("existingMsSqlServer")
     *             .resourceGroupName("existingResGroup")
     *             .build());
     *         ctx.export("id", example.applyValue(getServerResult -> getServerResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:mssql:getServer
     *       Arguments:
     *         name: existingMsSqlServer
     *         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 The name of this Microsoft SQL Server.
     * @param resourceGroupName The name of the Resource Group where the Microsoft SQL Server exists.
     * @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.mssql.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