1. Packages
  2. Alicloud Provider
  3. API Docs
  4. kms
  5. getKeyVersions
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.kms.getKeyVersions

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    This data source provides a list of KMS KeyVersions in an Alibaba Cloud account according to the specified filters.

    NOTE: Available in v1.85.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    // Declare the data source
    const alicloudKmsKeyVersionsDs = alicloud.kms.getKeyVersions({
        keyId: "08438c-b4d5-4d05-928c-07b7xxxx",
        ids: ["d89e8a53-b708-41aa-8c67-6873axxx"],
    });
    export const allVersions = alicloudKmsKeyVersionsDs.then(alicloudKmsKeyVersionsDs => alicloudKmsKeyVersionsDs.versions);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    # Declare the data source
    alicloud_kms_key_versions_ds = alicloud.kms.get_key_versions(key_id="08438c-b4d5-4d05-928c-07b7xxxx",
        ids=["d89e8a53-b708-41aa-8c67-6873axxx"])
    pulumi.export("allVersions", alicloud_kms_key_versions_ds.versions)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Declare the data source
    		alicloudKmsKeyVersionsDs, err := kms.GetKeyVersions(ctx, &kms.GetKeyVersionsArgs{
    			KeyId: "08438c-b4d5-4d05-928c-07b7xxxx",
    			Ids: []string{
    				"d89e8a53-b708-41aa-8c67-6873axxx",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("allVersions", alicloudKmsKeyVersionsDs.Versions)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // Declare the data source
        var alicloudKmsKeyVersionsDs = AliCloud.Kms.GetKeyVersions.Invoke(new()
        {
            KeyId = "08438c-b4d5-4d05-928c-07b7xxxx",
            Ids = new[]
            {
                "d89e8a53-b708-41aa-8c67-6873axxx",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["allVersions"] = alicloudKmsKeyVersionsDs.Apply(getKeyVersionsResult => getKeyVersionsResult.Versions),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.kms.KmsFunctions;
    import com.pulumi.alicloud.kms.inputs.GetKeyVersionsArgs;
    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) {
            // Declare the data source
            final var alicloudKmsKeyVersionsDs = KmsFunctions.getKeyVersions(GetKeyVersionsArgs.builder()
                .keyId("08438c-b4d5-4d05-928c-07b7xxxx")
                .ids("d89e8a53-b708-41aa-8c67-6873axxx")
                .build());
    
            ctx.export("allVersions", alicloudKmsKeyVersionsDs.applyValue(getKeyVersionsResult -> getKeyVersionsResult.versions()));
        }
    }
    
    variables:
      # Declare the data source
      alicloudKmsKeyVersionsDs:
        fn::invoke:
          Function: alicloud:kms:getKeyVersions
          Arguments:
            keyId: 08438c-b4d5-4d05-928c-07b7xxxx
            ids:
              - d89e8a53-b708-41aa-8c67-6873axxx
    outputs:
      allVersions: ${alicloudKmsKeyVersionsDs.versions}
    

    Using getKeyVersions

    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 getKeyVersions(args: GetKeyVersionsArgs, opts?: InvokeOptions): Promise<GetKeyVersionsResult>
    function getKeyVersionsOutput(args: GetKeyVersionsOutputArgs, opts?: InvokeOptions): Output<GetKeyVersionsResult>
    def get_key_versions(ids: Optional[Sequence[str]] = None,
                         key_id: Optional[str] = None,
                         output_file: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetKeyVersionsResult
    def get_key_versions_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         key_id: Optional[pulumi.Input[str]] = None,
                         output_file: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetKeyVersionsResult]
    func GetKeyVersions(ctx *Context, args *GetKeyVersionsArgs, opts ...InvokeOption) (*GetKeyVersionsResult, error)
    func GetKeyVersionsOutput(ctx *Context, args *GetKeyVersionsOutputArgs, opts ...InvokeOption) GetKeyVersionsResultOutput

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

    public static class GetKeyVersions 
    {
        public static Task<GetKeyVersionsResult> InvokeAsync(GetKeyVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyVersionsResult> Invoke(GetKeyVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyVersionsResult> getKeyVersions(GetKeyVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:kms/getKeyVersions:getKeyVersions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    KeyId string
    The id of kms key.
    Ids List<string>
    A list of KMS KeyVersion IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    KeyId string
    The id of kms key.
    Ids []string
    A list of KMS KeyVersion IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    keyId String
    The id of kms key.
    ids List<String>
    A list of KMS KeyVersion IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    keyId string
    The id of kms key.
    ids string[]
    A list of KMS KeyVersion IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    key_id str
    The id of kms key.
    ids Sequence[str]
    A list of KMS KeyVersion IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    keyId String
    The id of kms key.
    ids List<String>
    A list of KMS KeyVersion IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getKeyVersions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of KMS KeyVersion IDs.
    KeyId string
    ID of the key.
    Versions List<Pulumi.AliCloud.Kms.Outputs.GetKeyVersionsVersion>
    A list of KMS KeyVersions. Each element contains the following attributes:
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of KMS KeyVersion IDs.
    KeyId string
    ID of the key.
    Versions []GetKeyVersionsVersion
    A list of KMS KeyVersions. Each element contains the following attributes:
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of KMS KeyVersion IDs.
    keyId String
    ID of the key.
    versions List<GetKeyVersionsVersion>
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of KMS KeyVersion IDs.
    keyId string
    ID of the key.
    versions GetKeyVersionsVersion[]
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of KMS KeyVersion IDs.
    key_id str
    ID of the key.
    versions Sequence[GetKeyVersionsVersion]
    A list of KMS KeyVersions. Each element contains the following attributes:
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of KMS KeyVersion IDs.
    keyId String
    ID of the key.
    versions List<Property Map>
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile String

    Supporting Types

    GetKeyVersionsVersion

    CreateTime string
    Date and time when the key version was created (UTC time).
    CreationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    Id string
    ID of the KMS KeyVersion resource.
    KeyId string
    The id of kms key.
    KeyVersionId string
    ID of the key version.
    CreateTime string
    Date and time when the key version was created (UTC time).
    CreationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    Id string
    ID of the KMS KeyVersion resource.
    KeyId string
    The id of kms key.
    KeyVersionId string
    ID of the key version.
    createTime String
    Date and time when the key version was created (UTC time).
    creationDate String
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id String
    ID of the KMS KeyVersion resource.
    keyId String
    The id of kms key.
    keyVersionId String
    ID of the key version.
    createTime string
    Date and time when the key version was created (UTC time).
    creationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id string
    ID of the KMS KeyVersion resource.
    keyId string
    The id of kms key.
    keyVersionId string
    ID of the key version.
    create_time str
    Date and time when the key version was created (UTC time).
    creation_date str
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id str
    ID of the KMS KeyVersion resource.
    key_id str
    The id of kms key.
    key_version_id str
    ID of the key version.
    createTime String
    Date and time when the key version was created (UTC time).
    creationDate String
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id String
    ID of the KMS KeyVersion resource.
    keyId String
    The id of kms key.
    keyVersionId String
    ID of the key version.

    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
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi