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

com.pulumi.azure.postgresql.kotlin.PostgresqlFunctions.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.postgresql.kotlin

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

public object PostgresqlFunctions {
    /**
     * Use this data source to access information about an existing PostgreSQL Flexible Server.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.postgresql.getFlexibleServer({
     *     name: "existing-postgresql-fs",
     *     resourceGroupName: "existing-postgresql-resgroup",
     * });
     * export const id = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.postgresql.get_flexible_server(name="existing-postgresql-fs",
     *     resource_group_name="existing-postgresql-resgroup")
     * 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.PostgreSql.GetFlexibleServer.Invoke(new()
     *     {
     *         Name = "existing-postgresql-fs",
     *         ResourceGroupName = "existing-postgresql-resgroup",
     *     });
     *     return new Dictionary
     *     {
     *         ["id"] = example.Apply(getFlexibleServerResult => getFlexibleServerResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/postgresql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		example, err := postgresql.LookupFlexibleServer(ctx, &postgresql.LookupFlexibleServerArgs{
     * 			Name:              "existing-postgresql-fs",
     * 			ResourceGroupName: "existing-postgresql-resgroup",
     * 		}, 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.postgresql.PostgresqlFunctions;
     * import com.pulumi.azure.postgresql.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 = PostgresqlFunctions.getFlexibleServer(GetFlexibleServerArgs.builder()
     *             .name("existing-postgresql-fs")
     *             .resourceGroupName("existing-postgresql-resgroup")
     *             .build());
     *         ctx.export("id", example.applyValue(getFlexibleServerResult -> getFlexibleServerResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:postgresql:getFlexibleServer
     *       Arguments:
     *         name: existing-postgresql-fs
     *         resourceGroupName: existing-postgresql-resgroup
     * 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 The name of this PostgreSQL Flexible Server.
     * @param resourceGroupName The name of the Resource Group where the PostgreSQL Flexible Server exists.
     * @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.postgresql.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 PostgreSQL Azure Database Server.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = azure.postgresql.getServer({
     *     name: "postgresql-server-1",
     *     resourceGroupName: "api-rg-pro",
     * });
     * export const postgresqlServerId = example.then(example => example.id);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.postgresql.get_server(name="postgresql-server-1",
     *     resource_group_name="api-rg-pro")
     * pulumi.export("postgresqlServerId", example.id)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = Azure.PostgreSql.GetServer.Invoke(new()
     *     {
     *         Name = "postgresql-server-1",
     *         ResourceGroupName = "api-rg-pro",
     *     });
     *     return new Dictionary
     *     {
     *         ["postgresqlServerId"] = example.Apply(getServerResult => getServerResult.Id),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/postgresql"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		example, err := postgresql.LookupServer(ctx, &postgresql.LookupServerArgs{
     * 			Name:              "postgresql-server-1",
     * 			ResourceGroupName: "api-rg-pro",
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		ctx.Export("postgresqlServerId", 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.postgresql.PostgresqlFunctions;
     * import com.pulumi.azure.postgresql.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 = PostgresqlFunctions.getServer(GetServerArgs.builder()
     *             .name("postgresql-server-1")
     *             .resourceGroupName("api-rg-pro")
     *             .build());
     *         ctx.export("postgresqlServerId", example.applyValue(getServerResult -> getServerResult.id()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   example:
     *     fn::invoke:
     *       Function: azure:postgresql:getServer
     *       Arguments:
     *         name: postgresql-server-1
     *         resourceGroupName: api-rg-pro
     * outputs:
     *   postgresqlServerId: ${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 the PostgreSQL Server.
     * @param resourceGroupName Specifies the name of the Resource Group where the PostgreSQL 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.postgresql.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