1. Packages
  2. OVH
  3. API Docs
  4. CloudProjectDatabase
  5. getDatabases
OVHCloud v2.1.1 published on Thursday, Apr 10, 2025 by OVHcloud

ovh.CloudProjectDatabase.getDatabases

Explore with Pulumi AI

OVHCloud v2.1.1 published on Thursday, Apr 10, 2025 by OVHcloud

Use this data source to get the list of managed databases of a public cloud project.

Example Usage

To get the list of database clusters service for a given engine:

import * as pulumi from "@pulumi/pulumi";
import * as ovh from "@pulumi/ovh";

const dbs = ovh.CloudProjectDatabase.getDatabases({
    serviceName: "XXXXXX",
    engine: "YYYY",
});
export const clusterIds = dbs.then(dbs => dbs.clusterIds);
Copy
import pulumi
import pulumi_ovh as ovh

dbs = ovh.CloudProjectDatabase.get_databases(service_name="XXXXXX",
    engine="YYYY")
pulumi.export("clusterIds", dbs.cluster_ids)
Copy
package main

import (
	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh/cloudprojectdatabase"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dbs, err := cloudprojectdatabase.GetDatabases(ctx, &cloudprojectdatabase.GetDatabasesArgs{
			ServiceName: "XXXXXX",
			Engine:      "YYYY",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("clusterIds", dbs.ClusterIds)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ovh = Pulumi.Ovh;

return await Deployment.RunAsync(() => 
{
    var dbs = Ovh.CloudProjectDatabase.GetDatabases.Invoke(new()
    {
        ServiceName = "XXXXXX",
        Engine = "YYYY",
    });

    return new Dictionary<string, object?>
    {
        ["clusterIds"] = dbs.Apply(getDatabasesResult => getDatabasesResult.ClusterIds),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ovh.CloudProjectDatabase.CloudProjectDatabaseFunctions;
import com.pulumi.ovh.CloudProjectDatabase.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 dbs = CloudProjectDatabaseFunctions.getDatabases(GetDatabasesArgs.builder()
            .serviceName("XXXXXX")
            .engine("YYYY")
            .build());

        ctx.export("clusterIds", dbs.clusterIds());
    }
}
Copy
variables:
  dbs:
    fn::invoke:
      function: ovh:CloudProjectDatabase:getDatabases
      arguments:
        serviceName: XXXXXX
        engine: YYYY
outputs:
  clusterIds: ${dbs.clusterIds}
Copy

Using getDatabases

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDatabases(args: GetDatabasesArgs, opts?: InvokeOptions): Promise<GetDatabasesResult>
function getDatabasesOutput(args: GetDatabasesOutputArgs, opts?: InvokeOptions): Output<GetDatabasesResult>
Copy
def get_databases(engine: Optional[str] = None,
                  service_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetDatabasesResult
def get_databases_output(engine: Optional[pulumi.Input[str]] = None,
                  service_name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetDatabasesResult]
Copy
func GetDatabases(ctx *Context, args *GetDatabasesArgs, opts ...InvokeOption) (*GetDatabasesResult, error)
func GetDatabasesOutput(ctx *Context, args *GetDatabasesOutputArgs, opts ...InvokeOption) GetDatabasesResultOutput
Copy

> Note: This function is named GetDatabases in the Go SDK.

public static class GetDatabases 
{
    public static Task<GetDatabasesResult> InvokeAsync(GetDatabasesArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabasesResult> Invoke(GetDatabasesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDatabasesResult> getDatabases(GetDatabasesArgs args, InvokeOptions options)
public static Output<GetDatabasesResult> getDatabases(GetDatabasesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ovh:CloudProjectDatabase/getDatabases:getDatabases
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Engine This property is required. string
The database engine you want to list. To get a full list of available engine visit: public documentation.
ServiceName This property is required. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
Engine This property is required. string
The database engine you want to list. To get a full list of available engine visit: public documentation.
ServiceName This property is required. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
engine This property is required. String
The database engine you want to list. To get a full list of available engine visit: public documentation.
serviceName This property is required. String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
engine This property is required. string
The database engine you want to list. To get a full list of available engine visit: public documentation.
serviceName This property is required. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
engine This property is required. str
The database engine you want to list. To get a full list of available engine visit: public documentation.
service_name This property is required. str
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
engine This property is required. String
The database engine you want to list. To get a full list of available engine visit: public documentation.
serviceName This property is required. String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.

getDatabases Result

The following output properties are available:

ClusterIds List<string>
The list of managed databases ids of the project.
Engine string
See Argument Reference above.
Id string
The provider-assigned unique ID for this managed resource.
ServiceName string
See Argument Reference above.
ClusterIds []string
The list of managed databases ids of the project.
Engine string
See Argument Reference above.
Id string
The provider-assigned unique ID for this managed resource.
ServiceName string
See Argument Reference above.
clusterIds List<String>
The list of managed databases ids of the project.
engine String
See Argument Reference above.
id String
The provider-assigned unique ID for this managed resource.
serviceName String
See Argument Reference above.
clusterIds string[]
The list of managed databases ids of the project.
engine string
See Argument Reference above.
id string
The provider-assigned unique ID for this managed resource.
serviceName string
See Argument Reference above.
cluster_ids Sequence[str]
The list of managed databases ids of the project.
engine str
See Argument Reference above.
id str
The provider-assigned unique ID for this managed resource.
service_name str
See Argument Reference above.
clusterIds List<String>
The list of managed databases ids of the project.
engine String
See Argument Reference above.
id String
The provider-assigned unique ID for this managed resource.
serviceName String
See Argument Reference above.

Package Details

Repository
ovh ovh/pulumi-ovh
License
Apache-2.0
Notes
This Pulumi package is based on the ovh Terraform Provider.
OVHCloud v2.1.1 published on Thursday, Apr 10, 2025 by OVHcloud