1. Packages
  2. Linode Provider
  3. API Docs
  4. getDatabaseEngines
Linode v4.27.2 published on Tuesday, Sep 24, 2024 by Pulumi

linode.getDatabaseEngines

Explore with Pulumi AI

linode logo
Linode v4.27.2 published on Tuesday, Sep 24, 2024 by Pulumi

    Provides information about Linode Managed Database engines that match a set of filters. For more information, see the Linode APIv4 docs.

    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
    }
    ctx.Export("engineIds", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-28)))
    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=[{
        "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
    }
    ctx.Export("engineIds", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:8,11-30)))
    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=[{
            "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<GetDatabaseEnginesEngine>
    Filters List<GetDatabaseEnginesFilter>
    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; default asc)
    OrderBy string
    The attribute to order the results by. (version)
    Engines []GetDatabaseEnginesEngine
    Filters []GetDatabaseEnginesFilter
    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; default asc)
    OrderBy string
    The attribute to order the results by. (version)
    engines List<GetDatabaseEnginesEngine>
    filters List<GetDatabaseEnginesFilter>
    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; default asc)
    orderBy String
    The attribute to order the results by. (version)
    engines GetDatabaseEnginesEngine[]
    filters GetDatabaseEnginesFilter[]
    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; default asc)
    orderBy string
    The attribute to order the results by. (version)
    engines Sequence[GetDatabaseEnginesEngine]
    filters Sequence[GetDatabaseEnginesFilter]
    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; default asc)
    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; default asc)
    orderBy 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<GetDatabaseEnginesEngine>
    Filters List<GetDatabaseEnginesFilter>
    Latest bool
    Order string
    OrderBy string
    Id string
    The Managed Database engine ID in engine/version format.
    Engines []GetDatabaseEnginesEngine
    Filters []GetDatabaseEnginesFilter
    Latest bool
    Order string
    OrderBy string
    id String
    The Managed Database engine ID in engine/version format.
    engines List<GetDatabaseEnginesEngine>
    filters List<GetDatabaseEnginesFilter>
    latest Boolean
    order String
    orderBy String
    id string
    The Managed Database engine ID in engine/version format.
    engines GetDatabaseEnginesEngine[]
    filters GetDatabaseEnginesFilter[]
    latest boolean
    order string
    orderBy string
    id str
    The Managed Database engine ID in engine/version format.
    engines Sequence[GetDatabaseEnginesEngine]
    filters Sequence[GetDatabaseEnginesFilter]
    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
    orderBy String

    Supporting Types

    GetDatabaseEnginesEngine

    Engine string
    The Managed Database engine type.
    Id string
    The Managed Database engine ID in engine/version format.
    Version string
    The Managed Database engine version.
    Engine string
    The Managed Database engine type.
    Id string
    The Managed Database engine ID in engine/version format.
    Version string
    The Managed Database engine version.
    engine String
    The Managed Database engine type.
    id String
    The Managed Database engine ID in engine/version format.
    version String
    The Managed Database engine version.
    engine string
    The Managed Database engine type.
    id string
    The Managed Database engine ID in engine/version format.
    version string
    The Managed Database engine version.
    engine str
    The Managed Database engine type.
    id str
    The Managed Database engine ID in engine/version format.
    version str
    The Managed Database engine version.
    engine String
    The Managed Database engine type.
    id String
    The Managed Database engine ID in engine/version format.
    version String
    The Managed Database engine version.

    GetDatabaseEnginesFilter

    Name string
    The name of the field to filter by.
    Values List<string>
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    Name string
    The name of the field to filter by.
    Values []string
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)
    name string
    The name of the field to filter by.
    values string[]
    A list of values for the filter to allow. These values should all be in string form.
    matchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name str
    The name of the field to filter by.
    values Sequence[str]
    A list of values for the filter to allow. These values should all be in string form.
    match_by str
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v4.27.2 published on Tuesday, Sep 24, 2024 by Pulumi