com.pulumi.gcp.sql.kotlin.SqlFunctions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.sql.kotlin
import com.pulumi.gcp.sql.SqlFunctions.getBackupRunPlain
import com.pulumi.gcp.sql.SqlFunctions.getCaCertsPlain
import com.pulumi.gcp.sql.SqlFunctions.getDatabaseInstanceLatestRecoveryTimePlain
import com.pulumi.gcp.sql.SqlFunctions.getDatabaseInstancePlain
import com.pulumi.gcp.sql.SqlFunctions.getDatabaseInstancesPlain
import com.pulumi.gcp.sql.SqlFunctions.getDatabasePlain
import com.pulumi.gcp.sql.SqlFunctions.getDatabasesPlain
import com.pulumi.gcp.sql.SqlFunctions.getTiersPlain
import com.pulumi.gcp.sql.kotlin.inputs.GetBackupRunPlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetBackupRunPlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetCaCertsPlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetCaCertsPlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstanceLatestRecoveryTimePlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstanceLatestRecoveryTimePlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancePlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancePlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancesPlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancesPlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabasePlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabasePlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabasesPlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetDatabasesPlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.inputs.GetTiersPlainArgs
import com.pulumi.gcp.sql.kotlin.inputs.GetTiersPlainArgsBuilder
import com.pulumi.gcp.sql.kotlin.outputs.GetBackupRunResult
import com.pulumi.gcp.sql.kotlin.outputs.GetCaCertsResult
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstanceLatestRecoveryTimeResult
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstanceResult
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstancesResult
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseResult
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabasesResult
import com.pulumi.gcp.sql.kotlin.outputs.GetTiersResult
import kotlinx.coroutines.future.await
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.sql.kotlin.outputs.GetBackupRunResult.Companion.toKotlin as getBackupRunResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetCaCertsResult.Companion.toKotlin as getCaCertsResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstanceLatestRecoveryTimeResult.Companion.toKotlin as getDatabaseInstanceLatestRecoveryTimeResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstanceResult.Companion.toKotlin as getDatabaseInstanceResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseInstancesResult.Companion.toKotlin as getDatabaseInstancesResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabaseResult.Companion.toKotlin as getDatabaseResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetDatabasesResult.Companion.toKotlin as getDatabasesResultToKotlin
import com.pulumi.gcp.sql.kotlin.outputs.GetTiersResult.Companion.toKotlin as getTiersResultToKotlin
public object SqlFunctions {
/**
* Use this data source to get information about a Cloud SQL instance backup run.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const backup = gcp.sql.getBackupRun({
* instance: main.name,
* mostRecent: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* backup = gcp.sql.get_backup_run(instance=main["name"],
* most_recent=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var backup = Gcp.Sql.GetBackupRun.Invoke(new()
* {
* Instance = main.Name,
* MostRecent = true,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sql.GetBackupRun(ctx, &sql.GetBackupRunArgs{
* Instance: main.Name,
* MostRecent: pulumi.BoolRef(true),
* }, 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.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.inputs.GetBackupRunArgs;
* 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 backup = SqlFunctions.getBackupRun(GetBackupRunArgs.builder()
* .instance(main.name())
* .mostRecent(true)
* .build());
* }
* }
* ```
* ```yaml
* variables:
* backup:
* fn::invoke:
* Function: gcp:sql:getBackupRun
* Arguments:
* instance: ${main.name}
* mostRecent: true
* ```
*
* @param argument A collection of arguments for invoking getBackupRun.
* @return A collection of values returned by getBackupRun.
*/
public suspend fun getBackupRun(argument: GetBackupRunPlainArgs): GetBackupRunResult =
getBackupRunResultToKotlin(getBackupRunPlain(argument.toJava()).await())
/**
* @see [getBackupRun].
* @param backupId The identifier for this backup run. Unique only for a specific Cloud SQL instance.
* If left empty and multiple backups exist for the instance, `most_recent` must be set to `true`.
* @param instance The name of the instance the backup is taken from.
* @param mostRecent Toggles use of the most recent backup run if multiple backups exist for a
* Cloud SQL instance.
* @param project The project to list instances for. If it
* is not provided, the provider project is used.
* @return A collection of values returned by getBackupRun.
*/
public suspend fun getBackupRun(
backupId: Int? = null,
instance: String,
mostRecent: Boolean? = null,
project: String? = null,
): GetBackupRunResult {
val argument = GetBackupRunPlainArgs(
backupId = backupId,
instance = instance,
mostRecent = mostRecent,
project = project,
)
return getBackupRunResultToKotlin(getBackupRunPlain(argument.toJava()).await())
}
/**
* @see [getBackupRun].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetBackupRunPlainArgs].
* @return A collection of values returned by getBackupRun.
*/
public suspend fun getBackupRun(argument: suspend GetBackupRunPlainArgsBuilder.() -> Unit): GetBackupRunResult {
val builder = GetBackupRunPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getBackupRunResultToKotlin(getBackupRunPlain(builtArgument.toJava()).await())
}
/**
* Get all of the trusted Certificate Authorities (CAs) for the specified SQL database instance. For more information see the
* [official documentation](https://cloud.google.com/sql/)
* and
* [API](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/instances/listServerCas).
* @param argument A collection of arguments for invoking getCaCerts.
* @return A collection of values returned by getCaCerts.
*/
public suspend fun getCaCerts(argument: GetCaCertsPlainArgs): GetCaCertsResult =
getCaCertsResultToKotlin(getCaCertsPlain(argument.toJava()).await())
/**
* @see [getCaCerts].
* @param instance The name or self link of the instance.
* @param project The ID of the project in which the resource belongs. If `project` is not provided, the provider project is used.
* @return A collection of values returned by getCaCerts.
*/
public suspend fun getCaCerts(instance: String, project: String? = null): GetCaCertsResult {
val argument = GetCaCertsPlainArgs(
instance = instance,
project = project,
)
return getCaCertsResultToKotlin(getCaCertsPlain(argument.toJava()).await())
}
/**
* @see [getCaCerts].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetCaCertsPlainArgs].
* @return A collection of values returned by getCaCerts.
*/
public suspend fun getCaCerts(argument: suspend GetCaCertsPlainArgsBuilder.() -> Unit): GetCaCertsResult {
val builder = GetCaCertsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getCaCertsResultToKotlin(getCaCertsPlain(builtArgument.toJava()).await())
}
/**
* Use this data source to get information about a database in a Cloud SQL instance.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const qa = gcp.sql.getDatabase({
* name: "test-sql-database",
* instance: main.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* qa = gcp.sql.get_database(name="test-sql-database",
* instance=main["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var qa = Gcp.Sql.GetDatabase.Invoke(new()
* {
* Name = "test-sql-database",
* Instance = main.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sql.LookupDatabase(ctx, &sql.LookupDatabaseArgs{
* Name: "test-sql-database",
* Instance: main.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.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.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) {
* final var qa = SqlFunctions.getDatabase(GetDatabaseArgs.builder()
* .name("test-sql-database")
* .instance(main.name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* qa:
* fn::invoke:
* Function: gcp:sql:getDatabase
* Arguments:
* name: test-sql-database
* instance: ${main.name}
* ```
*
* @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 instance The name of the Cloud SQL database instance in which the database belongs.
* @param name The name of the database.
* @param project The ID of the project in which the instance belongs.
* @return A collection of values returned by getDatabase.
*/
public suspend fun getDatabase(
instance: String,
name: String,
project: String? = null,
): GetDatabaseResult {
val argument = GetDatabasePlainArgs(
instance = instance,
name = name,
project = project,
)
return getDatabaseResultToKotlin(getDatabasePlain(argument.toJava()).await())
}
/**
* @see [getDatabase].
* @param argument Builder for [com.pulumi.gcp.sql.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 get information about a Cloud SQL instance.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const qa = gcp.sql.getDatabaseInstance({
* name: "test-sql-instance",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* qa = gcp.sql.get_database_instance(name="test-sql-instance")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var qa = Gcp.Sql.GetDatabaseInstance.Invoke(new()
* {
* Name = "test-sql-instance",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sql.LookupDatabaseInstance(ctx, &sql.LookupDatabaseInstanceArgs{
* Name: "test-sql-instance",
* }, 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.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.inputs.GetDatabaseInstanceArgs;
* 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 qa = SqlFunctions.getDatabaseInstance(GetDatabaseInstanceArgs.builder()
* .name("test-sql-instance")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* qa:
* fn::invoke:
* Function: gcp:sql:getDatabaseInstance
* Arguments:
* name: test-sql-instance
* ```
*
* @param argument A collection of arguments for invoking getDatabaseInstance.
* @return A collection of values returned by getDatabaseInstance.
*/
public suspend fun getDatabaseInstance(argument: GetDatabaseInstancePlainArgs): GetDatabaseInstanceResult =
getDatabaseInstanceResultToKotlin(getDatabaseInstancePlain(argument.toJava()).await())
/**
* @see [getDatabaseInstance].
* @param name The name of the instance.
* @param project The ID of the project in which the resource belongs.
* @return A collection of values returned by getDatabaseInstance.
*/
public suspend fun getDatabaseInstance(name: String, project: String? = null): GetDatabaseInstanceResult {
val argument = GetDatabaseInstancePlainArgs(
name = name,
project = project,
)
return getDatabaseInstanceResultToKotlin(getDatabaseInstancePlain(argument.toJava()).await())
}
/**
* @see [getDatabaseInstance].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancePlainArgs].
* @return A collection of values returned by getDatabaseInstance.
*/
public suspend fun getDatabaseInstance(argument: suspend GetDatabaseInstancePlainArgsBuilder.() -> Unit): GetDatabaseInstanceResult {
val builder = GetDatabaseInstancePlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDatabaseInstanceResultToKotlin(getDatabaseInstancePlain(builtArgument.toJava()).await())
}
/**
* Get Latest Recovery Time for a given instance. For more information see the
* [official documentation](https://cloud.google.com/sql/)
* and
* [API](https://cloud.google.com/sql/docs/postgres/backup-recovery/pitr#get-the-latest-recovery-time).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const default = gcp.sql.getDatabaseInstanceLatestRecoveryTime({
* instance: "sample-instance",
* });
* export const latestRecoveryTime = _default;
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.sql.get_database_instance_latest_recovery_time(instance="sample-instance")
* pulumi.export("latestRecoveryTime", default)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = Gcp.Sql.GetDatabaseInstanceLatestRecoveryTime.Invoke(new()
* {
* Instance = "sample-instance",
* });
* return new Dictionary
* {
* ["latestRecoveryTime"] = @default,
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _default, err := sql.GetDatabaseInstanceLatestRecoveryTime(ctx, &sql.GetDatabaseInstanceLatestRecoveryTimeArgs{
* Instance: "sample-instance",
* }, nil)
* if err != nil {
* return err
* }
* ctx.Export("latestRecoveryTime", _default)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.inputs.GetDatabaseInstanceLatestRecoveryTimeArgs;
* 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 default = SqlFunctions.getDatabaseInstanceLatestRecoveryTime(GetDatabaseInstanceLatestRecoveryTimeArgs.builder()
* .instance("sample-instance")
* .build());
* ctx.export("latestRecoveryTime", default_);
* }
* }
* ```
* ```yaml
* variables:
* default:
* fn::invoke:
* Function: gcp:sql:getDatabaseInstanceLatestRecoveryTime
* Arguments:
* instance: sample-instance
* outputs:
* latestRecoveryTime: ${default}
* ```
*
* @param argument A collection of arguments for invoking getDatabaseInstanceLatestRecoveryTime.
* @return A collection of values returned by getDatabaseInstanceLatestRecoveryTime.
*/
public suspend fun getDatabaseInstanceLatestRecoveryTime(argument: GetDatabaseInstanceLatestRecoveryTimePlainArgs): GetDatabaseInstanceLatestRecoveryTimeResult =
getDatabaseInstanceLatestRecoveryTimeResultToKotlin(getDatabaseInstanceLatestRecoveryTimePlain(argument.toJava()).await())
/**
* @see [getDatabaseInstanceLatestRecoveryTime].
* @param instance The name of the instance.
* @param project The ID of the project in which the resource belongs.
* @return A collection of values returned by getDatabaseInstanceLatestRecoveryTime.
*/
public suspend fun getDatabaseInstanceLatestRecoveryTime(
instance: String,
project: String? =
null,
): GetDatabaseInstanceLatestRecoveryTimeResult {
val argument = GetDatabaseInstanceLatestRecoveryTimePlainArgs(
instance = instance,
project = project,
)
return getDatabaseInstanceLatestRecoveryTimeResultToKotlin(getDatabaseInstanceLatestRecoveryTimePlain(argument.toJava()).await())
}
/**
* @see [getDatabaseInstanceLatestRecoveryTime].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstanceLatestRecoveryTimePlainArgs].
* @return A collection of values returned by getDatabaseInstanceLatestRecoveryTime.
*/
public suspend fun getDatabaseInstanceLatestRecoveryTime(argument: suspend GetDatabaseInstanceLatestRecoveryTimePlainArgsBuilder.() -> Unit): GetDatabaseInstanceLatestRecoveryTimeResult {
val builder = GetDatabaseInstanceLatestRecoveryTimePlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDatabaseInstanceLatestRecoveryTimeResultToKotlin(getDatabaseInstanceLatestRecoveryTimePlain(builtArgument.toJava()).await())
}
/**
* Use this data source to get information about a list of Cloud SQL instances in a project. You can also apply some filters over this list to get a more filtered list of Cloud SQL instances.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const qa = gcp.sql.getDatabaseInstances({
* project: "test-project",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* qa = gcp.sql.get_database_instances(project="test-project")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var qa = Gcp.Sql.GetDatabaseInstances.Invoke(new()
* {
* Project = "test-project",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sql.GetDatabaseInstances(ctx, &sql.GetDatabaseInstancesArgs{
* Project: pulumi.StringRef("test-project"),
* }, 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.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.inputs.GetDatabaseInstancesArgs;
* 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 qa = SqlFunctions.getDatabaseInstances(GetDatabaseInstancesArgs.builder()
* .project("test-project")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* qa:
* fn::invoke:
* Function: gcp:sql:getDatabaseInstances
* Arguments:
* project: test-project
* ```
*
* @param argument A collection of arguments for invoking getDatabaseInstances.
* @return A collection of values returned by getDatabaseInstances.
*/
public suspend fun getDatabaseInstances(argument: GetDatabaseInstancesPlainArgs): GetDatabaseInstancesResult =
getDatabaseInstancesResultToKotlin(getDatabaseInstancesPlain(argument.toJava()).await())
/**
* @see [getDatabaseInstances].
* @param databaseVersion To filter out the Cloud SQL instances which are of the specified database version.
* @param project The ID of the project in which the resources belong. If it is not provided, the provider project is used.
* @param region To filter out the Cloud SQL instances which are located in the specified region.
* @param state To filter out the Cloud SQL instances based on the current serving state of the database instance. Supported values include `SQL_INSTANCE_STATE_UNSPECIFIED`, `RUNNABLE`, `SUSPENDED`, `PENDING_DELETE`, `PENDING_CREATE`, `MAINTENANCE`, `FAILED`.
* @param tier To filter out the Cloud SQL instances based on the tier(or machine type) of the database instances.
* @param zone To filter out the Cloud SQL instances which are located in the specified zone. This zone refers to the Compute Engine zone that the instance is currently serving from.
* @return A collection of values returned by getDatabaseInstances.
*/
public suspend fun getDatabaseInstances(
databaseVersion: String? = null,
project: String? = null,
region: String? = null,
state: String? = null,
tier: String? = null,
zone: String? = null,
): GetDatabaseInstancesResult {
val argument = GetDatabaseInstancesPlainArgs(
databaseVersion = databaseVersion,
project = project,
region = region,
state = state,
tier = tier,
zone = zone,
)
return getDatabaseInstancesResultToKotlin(getDatabaseInstancesPlain(argument.toJava()).await())
}
/**
* @see [getDatabaseInstances].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetDatabaseInstancesPlainArgs].
* @return A collection of values returned by getDatabaseInstances.
*/
public suspend fun getDatabaseInstances(argument: suspend GetDatabaseInstancesPlainArgsBuilder.() -> Unit): GetDatabaseInstancesResult {
val builder = GetDatabaseInstancesPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDatabaseInstancesResultToKotlin(getDatabaseInstancesPlain(builtArgument.toJava()).await())
}
/**
* Use this data source to get information about a list of databases in a Cloud SQL instance.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const qa = gcp.sql.getDatabases({
* instance: main.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* qa = gcp.sql.get_databases(instance=main["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var qa = Gcp.Sql.GetDatabases.Invoke(new()
* {
* Instance = main.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sql.GetDatabases(ctx, &sql.GetDatabasesArgs{
* Instance: main.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.gcp.sql.SqlFunctions;
* import com.pulumi.gcp.sql.inputs.GetDatabasesArgs;
* 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 qa = SqlFunctions.getDatabases(GetDatabasesArgs.builder()
* .instance(main.name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* qa:
* fn::invoke:
* Function: gcp:sql:getDatabases
* Arguments:
* instance: ${main.name}
* ```
*
* @param argument A collection of arguments for invoking getDatabases.
* @return A collection of values returned by getDatabases.
*/
public suspend fun getDatabases(argument: GetDatabasesPlainArgs): GetDatabasesResult =
getDatabasesResultToKotlin(getDatabasesPlain(argument.toJava()).await())
/**
* @see [getDatabases].
* @param instance The name of the Cloud SQL database instance in which the database belongs.
* @param project The ID of the project in which the instance belongs.
* > **Note** This datasource performs client-side sorting to provide consistent ordering of the databases.
* @return A collection of values returned by getDatabases.
*/
public suspend fun getDatabases(instance: String, project: String? = null): GetDatabasesResult {
val argument = GetDatabasesPlainArgs(
instance = instance,
project = project,
)
return getDatabasesResultToKotlin(getDatabasesPlain(argument.toJava()).await())
}
/**
* @see [getDatabases].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetDatabasesPlainArgs].
* @return A collection of values returned by getDatabases.
*/
public suspend fun getDatabases(argument: suspend GetDatabasesPlainArgsBuilder.() -> Unit): GetDatabasesResult {
val builder = GetDatabasesPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDatabasesResultToKotlin(getDatabasesPlain(builtArgument.toJava()).await())
}
/**
* Get all available machine types (tiers) for a project, for example, db-custom-1-3840. For more information see the
* [official documentation](https://cloud.google.com/sql/)
* and
* [API](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/tiers/list).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const tiers = gcp.sql.getTiers({
* project: "sample-project",
* });
* const allAvailableTiers = tiers.then(tiers => .map(v => (v.tier)));
* export const avaialbleTiers = allAvailableTiers;
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* tiers = gcp.sql.get_tiers(project="sample-project")
* all_available_tiers = [v.tier for v in tiers.tiers]
* pulumi.export("avaialbleTiers", all_available_tiers)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var tiers = Gcp.Sql.GetTiers.Invoke(new()
* {
* Project = "sample-project",
* });
* var allAvailableTiers = .Select(v =>
* {
* return v.Tier;
* }).ToList();
* return new Dictionary
* {
* ["avaialbleTiers"] = allAvailableTiers,
* };
* });
* ```
*
* @param argument A collection of arguments for invoking getTiers.
* @return A collection of values returned by getTiers.
*/
public suspend fun getTiers(argument: GetTiersPlainArgs): GetTiersResult =
getTiersResultToKotlin(getTiersPlain(argument.toJava()).await())
/**
* @see [getTiers].
* @param project The Project ID for which to list tiers. If `project` is not provided, the project defined within the default provider configuration is used.
* @return A collection of values returned by getTiers.
*/
public suspend fun getTiers(project: String? = null): GetTiersResult {
val argument = GetTiersPlainArgs(
project = project,
)
return getTiersResultToKotlin(getTiersPlain(argument.toJava()).await())
}
/**
* @see [getTiers].
* @param argument Builder for [com.pulumi.gcp.sql.kotlin.inputs.GetTiersPlainArgs].
* @return A collection of values returned by getTiers.
*/
public suspend fun getTiers(argument: suspend GetTiersPlainArgsBuilder.() -> Unit): GetTiersResult {
val builder = GetTiersPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getTiersResultToKotlin(getTiersPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy