1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. gpdb
  6. getApiKeys
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi

    This data source provides Gpdb Api Key available to the user.What is Api Key

    NOTE: Available since v1.286.0.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const workspaceId = config.get("workspaceId") || "ws-xxxxxxx";
    const _default = alicloud.gpdb.getApiKeys({
        workspaceId: workspaceId,
    });
    export const gpdbApiKeyId = _default.then(_default => _default.keys?.[0]?.keyId);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    workspace_id = config.get("workspaceId")
    if workspace_id is None:
        workspace_id = "ws-xxxxxxx"
    default = alicloud.gpdb.get_api_keys(workspace_id=workspace_id)
    pulumi.export("gpdbApiKeyId", default.keys[0].key_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/gpdb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		workspaceId := "ws-xxxxxxx"
    		if param := cfg.Get("workspaceId"); param != "" {
    			workspaceId = param
    		}
    		_default, err := gpdb.GetApiKeys(ctx, &gpdb.GetApiKeysArgs{
    			WorkspaceId: workspaceId,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("gpdbApiKeyId", _default.Keys[0].KeyId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var workspaceId = config.Get("workspaceId") ?? "ws-xxxxxxx";
        var @default = AliCloud.Gpdb.GetApiKeys.Invoke(new()
        {
            WorkspaceId = workspaceId,
        });
    
        return new Dictionary<string, object?>
        {
            ["gpdbApiKeyId"] = @default.Apply(@default => @default.Apply(getApiKeysResult => getApiKeysResult.Keys[0]?.KeyId)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.gpdb.GpdbFunctions;
    import com.pulumi.alicloud.gpdb.inputs.GetApiKeysArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 config = ctx.config();
            final var workspaceId = config.get("workspaceId").orElse("ws-xxxxxxx");
            final var default = GpdbFunctions.getApiKeys(GetApiKeysArgs.builder()
                .workspaceId(workspaceId)
                .build());
    
            ctx.export("gpdbApiKeyId", default_.keys()[0].keyId());
        }
    }
    
    configuration:
      workspaceId:
        type: string
        default: ws-xxxxxxx
    variables:
      default:
        fn::invoke:
          function: alicloud:gpdb:getApiKeys
          arguments:
            workspaceId: ${workspaceId}
    outputs:
      gpdbApiKeyId: ${default.keys[0].keyId}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_gpdb_getapikeys" "default" {
      workspace_id = var.workspaceId
    }
    
    variable "workspaceId" {
      type    = string
      default = "ws-xxxxxxx"
    }
    output "gpdbApiKeyId" {
      value = data.alicloud_gpdb_getapikeys.default.keys[0].key_id
    }
    

    Using getApiKeys

    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 getApiKeys(args: GetApiKeysArgs, opts?: InvokeOptions): Promise<GetApiKeysResult>
    function getApiKeysOutput(args: GetApiKeysOutputArgs, opts?: InvokeOutputOptions): Output<GetApiKeysResult>
    def get_api_keys(ids: Optional[Sequence[str]] = None,
                     output_file: Optional[str] = None,
                     workspace_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetApiKeysResult
    def get_api_keys_output(ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                     output_file: pulumi.Input[Optional[str]] = None,
                     workspace_id: pulumi.Input[Optional[str]] = None,
                     opts: Optional[InvokeOutputOptions] = None) -> Output[GetApiKeysResult]
    func GetApiKeys(ctx *Context, args *GetApiKeysArgs, opts ...InvokeOption) (*GetApiKeysResult, error)
    func GetApiKeysOutput(ctx *Context, args *GetApiKeysOutputArgs, opts ...InvokeOption) GetApiKeysResultOutput

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

    public static class GetApiKeys 
    {
        public static Task<GetApiKeysResult> InvokeAsync(GetApiKeysArgs args, InvokeOptions? opts = null)
        public static Output<GetApiKeysResult> Invoke(GetApiKeysInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetApiKeysResult> Invoke(GetApiKeysInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetApiKeysResult> getApiKeys(GetApiKeysArgs args, InvokeOptions options)
    public static Output<GetApiKeysResult> getApiKeys(GetApiKeysArgs args, InvokeOptions options)
    public static Output<GetApiKeysResult> getApiKeys(GetApiKeysArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: alicloud:gpdb/getApiKeys:getApiKeys
      arguments:
        # arguments dictionary
    data "alicloud_gpdb_get_api_keys" "name" {
        # arguments
    }

    The following arguments are supported:

    WorkspaceId string
    The ID of the workspace.
    Ids List<string>
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    WorkspaceId string
    The ID of the workspace.
    Ids []string
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    workspace_id string
    The ID of the workspace.
    ids list(string)
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    output_file string
    File name where to save data source results (after running pulumi preview).
    workspaceId String
    The ID of the workspace.
    ids List<String>
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    workspaceId string
    The ID of the workspace.
    ids string[]
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    workspace_id str
    The ID of the workspace.
    ids Sequence[str]
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    output_file str
    File name where to save data source results (after running pulumi preview).
    workspaceId String
    The ID of the workspace.
    ids List<String>
    A list of Api Key IDs. The value is formulated as <workspace_id>:<key_id>.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getApiKeys Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of Api Key IDs.
    Keys List<Pulumi.AliCloud.Gpdb.Outputs.GetApiKeysKey>
    A list of Api Key Entries. Each element contains the following attributes:
    WorkspaceId string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of Api Key IDs.
    Keys []GetApiKeysKey
    A list of Api Key Entries. Each element contains the following attributes:
    WorkspaceId string
    OutputFile string
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    A list of Api Key IDs.
    keys list(object)
    A list of Api Key Entries. Each element contains the following attributes:
    workspace_id string
    output_file string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Api Key IDs.
    keys List<GetApiKeysKey>
    A list of Api Key Entries. Each element contains the following attributes:
    workspaceId String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of Api Key IDs.
    keys GetApiKeysKey[]
    A list of Api Key Entries. Each element contains the following attributes:
    workspaceId string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of Api Key IDs.
    keys Sequence[GetApiKeysKey]
    A list of Api Key Entries. Each element contains the following attributes:
    workspace_id str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Api Key IDs.
    keys List<Property Map>
    A list of Api Key Entries. Each element contains the following attributes:
    workspaceId String
    outputFile String

    Supporting Types

    GetApiKeysKey

    CreateTime string
    The creation time of the resource.
    Description string
    The description of the API key.
    Id string
    The ID of the resource supplied above.
    KeyId string
    The ID of the API key.
    KeyName string
    The name of the API key.
    KeyPrefix string
    The prefix of the API key.
    CreateTime string
    The creation time of the resource.
    Description string
    The description of the API key.
    Id string
    The ID of the resource supplied above.
    KeyId string
    The ID of the API key.
    KeyName string
    The name of the API key.
    KeyPrefix string
    The prefix of the API key.
    create_time string
    The creation time of the resource.
    description string
    The description of the API key.
    id string
    The ID of the resource supplied above.
    key_id string
    The ID of the API key.
    key_name string
    The name of the API key.
    key_prefix string
    The prefix of the API key.
    createTime String
    The creation time of the resource.
    description String
    The description of the API key.
    id String
    The ID of the resource supplied above.
    keyId String
    The ID of the API key.
    keyName String
    The name of the API key.
    keyPrefix String
    The prefix of the API key.
    createTime string
    The creation time of the resource.
    description string
    The description of the API key.
    id string
    The ID of the resource supplied above.
    keyId string
    The ID of the API key.
    keyName string
    The name of the API key.
    keyPrefix string
    The prefix of the API key.
    create_time str
    The creation time of the resource.
    description str
    The description of the API key.
    id str
    The ID of the resource supplied above.
    key_id str
    The ID of the API key.
    key_name str
    The name of the API key.
    key_prefix str
    The prefix of the API key.
    createTime String
    The creation time of the resource.
    description String
    The description of the API key.
    id String
    The ID of the resource supplied above.
    keyId String
    The ID of the API key.
    keyName String
    The name of the API key.
    keyPrefix String
    The prefix of the API key.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.106.0
    published on Monday, Aug 24, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial