1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ess
  5. getLifecycleHooks
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.ess.getLifecycleHooks

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides available lifecycle hook resources.

    NOTE: Available in 1.72.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ds = alicloud.ess.getLifecycleHooks({
        scalingGroupId: "scaling_group_id",
        nameRegex: "lifecyclehook_name",
    });
    export const firstLifecycleHook = ds.then(ds => ds.hooks?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ds = alicloud.ess.get_lifecycle_hooks(scaling_group_id="scaling_group_id",
        name_regex="lifecyclehook_name")
    pulumi.export("firstLifecycleHook", ds.hooks[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ess"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ds, err := ess.GetLifecycleHooks(ctx, &ess.GetLifecycleHooksArgs{
    			ScalingGroupId: pulumi.StringRef("scaling_group_id"),
    			NameRegex:      pulumi.StringRef("lifecyclehook_name"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstLifecycleHook", ds.Hooks[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ds = AliCloud.Ess.GetLifecycleHooks.Invoke(new()
        {
            ScalingGroupId = "scaling_group_id",
            NameRegex = "lifecyclehook_name",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstLifecycleHook"] = ds.Apply(getLifecycleHooksResult => getLifecycleHooksResult.Hooks[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ess.EssFunctions;
    import com.pulumi.alicloud.ess.inputs.GetLifecycleHooksArgs;
    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 ds = EssFunctions.getLifecycleHooks(GetLifecycleHooksArgs.builder()
                .scalingGroupId("scaling_group_id")
                .nameRegex("lifecyclehook_name")
                .build());
    
            ctx.export("firstLifecycleHook", ds.applyValue(getLifecycleHooksResult -> getLifecycleHooksResult.hooks()[0].id()));
        }
    }
    
    variables:
      ds:
        fn::invoke:
          Function: alicloud:ess:getLifecycleHooks
          Arguments:
            scalingGroupId: scaling_group_id
            nameRegex: lifecyclehook_name
    outputs:
      firstLifecycleHook: ${ds.hooks[0].id}
    

    Using getLifecycleHooks

    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 getLifecycleHooks(args: GetLifecycleHooksArgs, opts?: InvokeOptions): Promise<GetLifecycleHooksResult>
    function getLifecycleHooksOutput(args: GetLifecycleHooksOutputArgs, opts?: InvokeOptions): Output<GetLifecycleHooksResult>
    def get_lifecycle_hooks(ids: Optional[Sequence[str]] = None,
                            name_regex: Optional[str] = None,
                            output_file: Optional[str] = None,
                            scaling_group_id: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetLifecycleHooksResult
    def get_lifecycle_hooks_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            name_regex: Optional[pulumi.Input[str]] = None,
                            output_file: Optional[pulumi.Input[str]] = None,
                            scaling_group_id: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetLifecycleHooksResult]
    func GetLifecycleHooks(ctx *Context, args *GetLifecycleHooksArgs, opts ...InvokeOption) (*GetLifecycleHooksResult, error)
    func GetLifecycleHooksOutput(ctx *Context, args *GetLifecycleHooksOutputArgs, opts ...InvokeOption) GetLifecycleHooksResultOutput

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

    public static class GetLifecycleHooks 
    {
        public static Task<GetLifecycleHooksResult> InvokeAsync(GetLifecycleHooksArgs args, InvokeOptions? opts = null)
        public static Output<GetLifecycleHooksResult> Invoke(GetLifecycleHooksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLifecycleHooksResult> getLifecycleHooks(GetLifecycleHooksArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:ess/getLifecycleHooks:getLifecycleHooks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of lifecycle hook IDs.
    NameRegex string
    A regex string to filter resulting lifecycle hook by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ScalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    Ids []string
    A list of lifecycle hook IDs.
    NameRegex string
    A regex string to filter resulting lifecycle hook by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ScalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    ids List<String>
    A list of lifecycle hook IDs.
    nameRegex String
    A regex string to filter resulting lifecycle hook by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    scalingGroupId String
    Scaling group id the lifecycle hooks belong to.
    ids string[]
    A list of lifecycle hook IDs.
    nameRegex string
    A regex string to filter resulting lifecycle hook by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    scalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    ids Sequence[str]
    A list of lifecycle hook IDs.
    name_regex str
    A regex string to filter resulting lifecycle hook by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    scaling_group_id str
    Scaling group id the lifecycle hooks belong to.
    ids List<String>
    A list of lifecycle hook IDs.
    nameRegex String
    A regex string to filter resulting lifecycle hook by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    scalingGroupId String
    Scaling group id the lifecycle hooks belong to.

    getLifecycleHooks Result

    The following output properties are available:

    Hooks List<Pulumi.AliCloud.Ess.Outputs.GetLifecycleHooksHook>
    A list of lifecycle hooks. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of lifecycle hook ids.
    Names List<string>
    A list of lifecycle hook names.
    NameRegex string
    OutputFile string
    ScalingGroupId string
    ID of the scaling group.
    Hooks []GetLifecycleHooksHook
    A list of lifecycle hooks. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of lifecycle hook ids.
    Names []string
    A list of lifecycle hook names.
    NameRegex string
    OutputFile string
    ScalingGroupId string
    ID of the scaling group.
    hooks List<GetLifecycleHooksHook>
    A list of lifecycle hooks. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of lifecycle hook ids.
    names List<String>
    A list of lifecycle hook names.
    nameRegex String
    outputFile String
    scalingGroupId String
    ID of the scaling group.
    hooks GetLifecycleHooksHook[]
    A list of lifecycle hooks. Each element contains the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of lifecycle hook ids.
    names string[]
    A list of lifecycle hook names.
    nameRegex string
    outputFile string
    scalingGroupId string
    ID of the scaling group.
    hooks Sequence[GetLifecycleHooksHook]
    A list of lifecycle hooks. Each element contains the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of lifecycle hook ids.
    names Sequence[str]
    A list of lifecycle hook names.
    name_regex str
    output_file str
    scaling_group_id str
    ID of the scaling group.
    hooks List<Property Map>
    A list of lifecycle hooks. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of lifecycle hook ids.
    names List<String>
    A list of lifecycle hook names.
    nameRegex String
    outputFile String
    scalingGroupId String
    ID of the scaling group.

    Supporting Types

    GetLifecycleHooksHook

    DefaultResult string
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    HeartbeatTimeout int
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    Id string
    ID of the lifecycle hook.
    LifecycleTransition string
    Type of Scaling activity attached to lifecycle hook.
    Name string
    Name of the lifecycle hook.
    NotificationArn string
    The Arn of notification target.
    NotificationMetadata string
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    ScalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    DefaultResult string
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    HeartbeatTimeout int
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    Id string
    ID of the lifecycle hook.
    LifecycleTransition string
    Type of Scaling activity attached to lifecycle hook.
    Name string
    Name of the lifecycle hook.
    NotificationArn string
    The Arn of notification target.
    NotificationMetadata string
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    ScalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    defaultResult String
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    heartbeatTimeout Integer
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    id String
    ID of the lifecycle hook.
    lifecycleTransition String
    Type of Scaling activity attached to lifecycle hook.
    name String
    Name of the lifecycle hook.
    notificationArn String
    The Arn of notification target.
    notificationMetadata String
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    scalingGroupId String
    Scaling group id the lifecycle hooks belong to.
    defaultResult string
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    heartbeatTimeout number
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    id string
    ID of the lifecycle hook.
    lifecycleTransition string
    Type of Scaling activity attached to lifecycle hook.
    name string
    Name of the lifecycle hook.
    notificationArn string
    The Arn of notification target.
    notificationMetadata string
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    scalingGroupId string
    Scaling group id the lifecycle hooks belong to.
    default_result str
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    heartbeat_timeout int
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    id str
    ID of the lifecycle hook.
    lifecycle_transition str
    Type of Scaling activity attached to lifecycle hook.
    name str
    Name of the lifecycle hook.
    notification_arn str
    The Arn of notification target.
    notification_metadata str
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    scaling_group_id str
    Scaling group id the lifecycle hooks belong to.
    defaultResult String
    Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses.
    heartbeatTimeout Number
    Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter.
    id String
    ID of the lifecycle hook.
    lifecycleTransition String
    Type of Scaling activity attached to lifecycle hook.
    name String
    Name of the lifecycle hook.
    notificationArn String
    The Arn of notification target.
    notificationMetadata String
    Additional information that you want to include when Auto Scaling sends a message to the notification target.
    scalingGroupId String
    Scaling group id the lifecycle hooks belong to.

    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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi