Linode v4.22.0 published on Tuesday, Jun 25, 2024 by Pulumi
linode.getDatabaseEngines
Explore with Pulumi AI
Provides information about Linode Managed Database engines that match a set of filters.
Example Usage
Get information about all Linode Managed Database engines:
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const all = linode.getDatabaseEngines({});
export const engineIds = all.then(all => all.engines.map(__item => __item.id));
import pulumi
import pulumi_linode as linode
all = linode.get_database_engines()
pulumi.export("engineIds", [__item.id for __item in all.engines])
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
all, err := linode.GetDatabaseEngines(ctx, nil, nil)
if err != nil {
return err
}
var splat0 []*string
for _, val0 := range all.Engines {
splat0 = append(splat0, val0.Id)
}
ctx.Export("engineIds", splat0)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var all = Linode.GetDatabaseEngines.Invoke();
return new Dictionary<string, object?>
{
["engineIds"] = all.Apply(getDatabaseEnginesResult => getDatabaseEnginesResult.Engines).Select(__item => __item.Id).ToList(),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetDatabaseEnginesArgs;
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 all = LinodeFunctions.getDatabaseEngines();
ctx.export("engineIds", all.applyValue(getDatabaseEnginesResult -> getDatabaseEnginesResult.engines()).stream().map(element -> element.id()).collect(toList()));
}
}
Coming soon!
Get information about all Linode MySQL Database engines:
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const mysql = linode.getDatabaseEngines({
filters: [{
name: "engine",
values: ["mysql"],
}],
});
export const engineIds = mysql.then(mysql => mysql.engines.map(__item => __item.id));
import pulumi
import pulumi_linode as linode
mysql = linode.get_database_engines(filters=[linode.GetDatabaseEnginesFilterArgs(
name="engine",
values=["mysql"],
)])
pulumi.export("engineIds", [__item.id for __item in mysql.engines])
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mysql, err := linode.GetDatabaseEngines(ctx, &linode.GetDatabaseEnginesArgs{
Filters: []linode.GetDatabaseEnginesFilter{
{
Name: "engine",
Values: []string{
"mysql",
},
},
},
}, nil)
if err != nil {
return err
}
var splat0 []*string
for _, val0 := range mysql.Engines {
splat0 = append(splat0, val0.Id)
}
ctx.Export("engineIds", splat0)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var mysql = Linode.GetDatabaseEngines.Invoke(new()
{
Filters = new[]
{
new Linode.Inputs.GetDatabaseEnginesFilterInputArgs
{
Name = "engine",
Values = new[]
{
"mysql",
},
},
},
});
return new Dictionary<string, object?>
{
["engineIds"] = mysql.Apply(getDatabaseEnginesResult => getDatabaseEnginesResult.Engines).Select(__item => __item.Id).ToList(),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetDatabaseEnginesArgs;
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 mysql = LinodeFunctions.getDatabaseEngines(GetDatabaseEnginesArgs.builder()
.filters(GetDatabaseEnginesFilterArgs.builder()
.name("engine")
.values("mysql")
.build())
.build());
ctx.export("engineIds", mysql.applyValue(getDatabaseEnginesResult -> getDatabaseEnginesResult.engines()).stream().map(element -> element.id()).collect(toList()));
}
}
Coming soon!
Create a Linode MySQL Database using the latest support MySQL version:
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const mysql = linode.getDatabaseEngines({
latest: true,
filters: [{
name: "engine",
values: ["mysql"],
}],
});
const myDb = new linode.DatabaseMysql("my_db", {
label: "mydb",
engineId: mysql.then(mysql => mysql.engines?.[0]?.id),
region: "us-southeast",
type: "g6-nanode-1",
});
import pulumi
import pulumi_linode as linode
mysql = linode.get_database_engines(latest=True,
filters=[linode.GetDatabaseEnginesFilterArgs(
name="engine",
values=["mysql"],
)])
my_db = linode.DatabaseMysql("my_db",
label="mydb",
engine_id=mysql.engines[0].id,
region="us-southeast",
type="g6-nanode-1")
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mysql, err := linode.GetDatabaseEngines(ctx, &linode.GetDatabaseEnginesArgs{
Latest: pulumi.BoolRef(true),
Filters: []linode.GetDatabaseEnginesFilter{
{
Name: "engine",
Values: []string{
"mysql",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = linode.NewDatabaseMysql(ctx, "my_db", &linode.DatabaseMysqlArgs{
Label: pulumi.String("mydb"),
EngineId: pulumi.String(mysql.Engines[0].Id),
Region: pulumi.String("us-southeast"),
Type: pulumi.String("g6-nanode-1"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var mysql = Linode.GetDatabaseEngines.Invoke(new()
{
Latest = true,
Filters = new[]
{
new Linode.Inputs.GetDatabaseEnginesFilterInputArgs
{
Name = "engine",
Values = new[]
{
"mysql",
},
},
},
});
var myDb = new Linode.DatabaseMysql("my_db", new()
{
Label = "mydb",
EngineId = mysql.Apply(getDatabaseEnginesResult => getDatabaseEnginesResult.Engines[0]?.Id),
Region = "us-southeast",
Type = "g6-nanode-1",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetDatabaseEnginesArgs;
import com.pulumi.linode.DatabaseMysql;
import com.pulumi.linode.DatabaseMysqlArgs;
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 mysql = LinodeFunctions.getDatabaseEngines(GetDatabaseEnginesArgs.builder()
.latest(true)
.filters(GetDatabaseEnginesFilterArgs.builder()
.name("engine")
.values("mysql")
.build())
.build());
var myDb = new DatabaseMysql("myDb", DatabaseMysqlArgs.builder()
.label("mydb")
.engineId(mysql.applyValue(getDatabaseEnginesResult -> getDatabaseEnginesResult.engines()[0].id()))
.region("us-southeast")
.type("g6-nanode-1")
.build());
}
}
resources:
myDb:
type: linode:DatabaseMysql
name: my_db
properties:
label: mydb
engineId: ${mysql.engines[0].id}
region: us-southeast
type: g6-nanode-1
variables:
mysql:
fn::invoke:
Function: linode:getDatabaseEngines
Arguments:
latest: true
filters:
- name: engine
values:
- mysql
Using getDatabaseEngines
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 getDatabaseEngines(args: GetDatabaseEnginesArgs, opts?: InvokeOptions): Promise<GetDatabaseEnginesResult>
function getDatabaseEnginesOutput(args: GetDatabaseEnginesOutputArgs, opts?: InvokeOptions): Output<GetDatabaseEnginesResult>
def get_database_engines(engines: Optional[Sequence[GetDatabaseEnginesEngine]] = None,
filters: Optional[Sequence[GetDatabaseEnginesFilter]] = None,
latest: Optional[bool] = None,
order: Optional[str] = None,
order_by: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetDatabaseEnginesResult
def get_database_engines_output(engines: Optional[pulumi.Input[Sequence[pulumi.Input[GetDatabaseEnginesEngineArgs]]]] = None,
filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetDatabaseEnginesFilterArgs]]]] = None,
latest: Optional[pulumi.Input[bool]] = None,
order: Optional[pulumi.Input[str]] = None,
order_by: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseEnginesResult]
func GetDatabaseEngines(ctx *Context, args *GetDatabaseEnginesArgs, opts ...InvokeOption) (*GetDatabaseEnginesResult, error)
func GetDatabaseEnginesOutput(ctx *Context, args *GetDatabaseEnginesOutputArgs, opts ...InvokeOption) GetDatabaseEnginesResultOutput
> Note: This function is named GetDatabaseEngines
in the Go SDK.
public static class GetDatabaseEngines
{
public static Task<GetDatabaseEnginesResult> InvokeAsync(GetDatabaseEnginesArgs args, InvokeOptions? opts = null)
public static Output<GetDatabaseEnginesResult> Invoke(GetDatabaseEnginesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatabaseEnginesResult> getDatabaseEngines(GetDatabaseEnginesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: linode:index/getDatabaseEngines:getDatabaseEngines
arguments:
# arguments dictionary
The following arguments are supported:
- Engines
List<Get
Database Engines Engine> - Filters
List<Get
Database Engines Filter> - Latest bool
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- Order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - Order
By string - The attribute to order the results by. (
version
)
- Engines
[]Get
Database Engines Engine - Filters
[]Get
Database Engines Filter - Latest bool
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- Order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - Order
By string - The attribute to order the results by. (
version
)
- engines
List<Get
Database Engines Engine> - filters
List<Get
Database Engines Filter> - latest Boolean
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- order String
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By String - The attribute to order the results by. (
version
)
- engines
Get
Database Engines Engine[] - filters
Get
Database Engines Filter[] - latest boolean
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By string - The attribute to order the results by. (
version
)
- engines
Sequence[Get
Database Engines Engine] - filters
Sequence[Get
Database Engines Filter] - latest bool
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- order str
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order_
by str - The attribute to order the results by. (
version
)
- engines List<Property Map>
- filters List<Property Map>
- latest Boolean
- If true, only the latest engine version will be returned.
filter
- (Optional) A set of filters used to select engines that meet certain requirements.
- order String
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By String - The attribute to order the results by. (
version
)
getDatabaseEngines Result
The following output properties are available:
- Id string
- The Managed Database engine ID in engine/version format.
- Engines
List<Get
Database Engines Engine> - Filters
List<Get
Database Engines Filter> - Latest bool
- Order string
- Order
By string
- Id string
- The Managed Database engine ID in engine/version format.
- Engines
[]Get
Database Engines Engine - Filters
[]Get
Database Engines Filter - Latest bool
- Order string
- Order
By string
- id String
- The Managed Database engine ID in engine/version format.
- engines
List<Get
Database Engines Engine> - filters
List<Get
Database Engines Filter> - latest Boolean
- order String
- order
By String
- id string
- The Managed Database engine ID in engine/version format.
- engines
Get
Database Engines Engine[] - filters
Get
Database Engines Filter[] - latest boolean
- order string
- order
By string
- id str
- The Managed Database engine ID in engine/version format.
- engines
Sequence[Get
Database Engines Engine] - filters
Sequence[Get
Database Engines Filter] - latest bool
- order str
- order_
by str
- id String
- The Managed Database engine ID in engine/version format.
- engines List<Property Map>
- filters List<Property Map>
- latest Boolean
- order String
- order
By String
Supporting Types
GetDatabaseEnginesEngine
GetDatabaseEnginesFilter
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
linode
Terraform Provider.