1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. actiontrail
  5. HistoryDeliveryJob
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.actiontrail.HistoryDeliveryJob

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    Provides a Actiontrail History Delivery Job resource.

    For information about Actiontrail History Delivery Job and how to use it, see What is History Delivery Job.

    NOTE: Available since v1.139.0.

    NOTE: You are authorized to use the historical event delivery task feature. To use this feature, submit a ticket or ask the sales manager to add you to the whitelist.

    NOTE: Make sure that you have called the alicloud.actiontrail.Trail to create a single-account or multi-account trace that delivered to Log Service SLS.

    NOTE: An Alibaba cloud account can only have one running delivery history job at the same time.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = new random.RandomInteger("default", {
        min: 10000,
        max: 99999,
    });
    const exampleRegions = alicloud.getRegions({
        current: true,
    });
    const exampleAccount = alicloud.getAccount({});
    const exampleProject = new alicloud.log.Project("exampleProject", {
        projectName: pulumi.interpolate`${name}-${_default.result}`,
        description: "tf actiontrail example",
    });
    const exampleTrail = new alicloud.actiontrail.Trail("exampleTrail", {
        trailName: pulumi.interpolate`${name}-${_default.result}`,
        slsProjectArn: pulumi.all([exampleRegions, exampleAccount, exampleProject.name]).apply(([exampleRegions, exampleAccount, name]) => `acs:log:${exampleRegions.regions?.[0]?.id}:${exampleAccount.id}:project/${name}`),
    });
    const exampleHistoryDeliveryJob = new alicloud.actiontrail.HistoryDeliveryJob("exampleHistoryDeliveryJob", {trailName: exampleTrail.id});
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = random.RandomInteger("default",
        min=10000,
        max=99999)
    example_regions = alicloud.get_regions(current=True)
    example_account = alicloud.get_account()
    example_project = alicloud.log.Project("exampleProject",
        project_name=default.result.apply(lambda result: f"{name}-{result}"),
        description="tf actiontrail example")
    example_trail = alicloud.actiontrail.Trail("exampleTrail",
        trail_name=default.result.apply(lambda result: f"{name}-{result}"),
        sls_project_arn=example_project.name.apply(lambda name: f"acs:log:{example_regions.regions[0].id}:{example_account.id}:project/{name}"))
    example_history_delivery_job = alicloud.actiontrail.HistoryDeliveryJob("exampleHistoryDeliveryJob", trail_name=example_trail.id)
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/actiontrail"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"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, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := random.NewRandomInteger(ctx, "default", &random.RandomIntegerArgs{
    			Min: pulumi.Int(10000),
    			Max: pulumi.Int(99999),
    		})
    		if err != nil {
    			return err
    		}
    		exampleRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := alicloud.GetAccount(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		exampleProject, err := log.NewProject(ctx, "exampleProject", &log.ProjectArgs{
    			ProjectName: _default.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("%v-%v", name, result), nil
    			}).(pulumi.StringOutput),
    			Description: pulumi.String("tf actiontrail example"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleTrail, err := actiontrail.NewTrail(ctx, "exampleTrail", &actiontrail.TrailArgs{
    			TrailName: _default.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("%v-%v", name, result), nil
    			}).(pulumi.StringOutput),
    			SlsProjectArn: exampleProject.Name.ApplyT(func(name string) (string, error) {
    				return fmt.Sprintf("acs:log:%v:%v:project/%v", exampleRegions.Regions[0].Id, exampleAccount.Id, name), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = actiontrail.NewHistoryDeliveryJob(ctx, "exampleHistoryDeliveryJob", &actiontrail.HistoryDeliveryJobArgs{
    			TrailName: exampleTrail.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = new Random.RandomInteger("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var exampleRegions = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var exampleAccount = AliCloud.GetAccount.Invoke();
    
        var exampleProject = new AliCloud.Log.Project("exampleProject", new()
        {
            ProjectName = @default.Result.Apply(result => $"{name}-{result}"),
            Description = "tf actiontrail example",
        });
    
        var exampleTrail = new AliCloud.ActionTrail.Trail("exampleTrail", new()
        {
            TrailName = @default.Result.Apply(result => $"{name}-{result}"),
            SlsProjectArn = Output.Tuple(exampleRegions, exampleAccount, exampleProject.Name).Apply(values =>
            {
                var exampleRegions = values.Item1;
                var exampleAccount = values.Item2;
                var name = values.Item3;
                return $"acs:log:{exampleRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:{exampleAccount.Apply(getAccountResult => getAccountResult.Id)}:project/{name}";
            }),
        });
    
        var exampleHistoryDeliveryJob = new AliCloud.ActionTrail.HistoryDeliveryJob("exampleHistoryDeliveryJob", new()
        {
            TrailName = exampleTrail.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetRegionsArgs;
    import com.pulumi.alicloud.log.Project;
    import com.pulumi.alicloud.log.ProjectArgs;
    import com.pulumi.alicloud.actiontrail.Trail;
    import com.pulumi.alicloud.actiontrail.TrailArgs;
    import com.pulumi.alicloud.actiontrail.HistoryDeliveryJob;
    import com.pulumi.alicloud.actiontrail.HistoryDeliveryJobArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var default_ = new RandomInteger("default", RandomIntegerArgs.builder()        
                .min(10000)
                .max(99999)
                .build());
    
            final var exampleRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            final var exampleAccount = AlicloudFunctions.getAccount();
    
            var exampleProject = new Project("exampleProject", ProjectArgs.builder()        
                .projectName(default_.result().applyValue(result -> String.format("%s-%s", name,result)))
                .description("tf actiontrail example")
                .build());
    
            var exampleTrail = new Trail("exampleTrail", TrailArgs.builder()        
                .trailName(default_.result().applyValue(result -> String.format("%s-%s", name,result)))
                .slsProjectArn(exampleProject.name().applyValue(name -> String.format("acs:log:%s:%s:project/%s", exampleRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),exampleAccount.applyValue(getAccountResult -> getAccountResult.id()),name)))
                .build());
    
            var exampleHistoryDeliveryJob = new HistoryDeliveryJob("exampleHistoryDeliveryJob", HistoryDeliveryJobArgs.builder()        
                .trailName(exampleTrail.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      default:
        type: random:RandomInteger
        properties:
          min: 10000
          max: 99999
      exampleProject:
        type: alicloud:log:Project
        properties:
          projectName: ${name}-${default.result}
          description: tf actiontrail example
      exampleTrail:
        type: alicloud:actiontrail:Trail
        properties:
          trailName: ${name}-${default.result}
          slsProjectArn: acs:log:${exampleRegions.regions[0].id}:${exampleAccount.id}:project/${exampleProject.name}
      exampleHistoryDeliveryJob:
        type: alicloud:actiontrail:HistoryDeliveryJob
        properties:
          trailName: ${exampleTrail.id}
    variables:
      exampleRegions:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
      exampleAccount:
        fn::invoke:
          Function: alicloud:getAccount
          Arguments: {}
    

    Create HistoryDeliveryJob Resource

    new HistoryDeliveryJob(name: string, args: HistoryDeliveryJobArgs, opts?: CustomResourceOptions);
    @overload
    def HistoryDeliveryJob(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           trail_name: Optional[str] = None)
    @overload
    def HistoryDeliveryJob(resource_name: str,
                           args: HistoryDeliveryJobArgs,
                           opts: Optional[ResourceOptions] = None)
    func NewHistoryDeliveryJob(ctx *Context, name string, args HistoryDeliveryJobArgs, opts ...ResourceOption) (*HistoryDeliveryJob, error)
    public HistoryDeliveryJob(string name, HistoryDeliveryJobArgs args, CustomResourceOptions? opts = null)
    public HistoryDeliveryJob(String name, HistoryDeliveryJobArgs args)
    public HistoryDeliveryJob(String name, HistoryDeliveryJobArgs args, CustomResourceOptions options)
    
    type: alicloud:actiontrail:HistoryDeliveryJob
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args HistoryDeliveryJobArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args HistoryDeliveryJobArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args HistoryDeliveryJobArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HistoryDeliveryJobArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HistoryDeliveryJobArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    HistoryDeliveryJob Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The HistoryDeliveryJob resource accepts the following input properties:

    TrailName string
    The name of the trail for which you want to create a historical event delivery task.
    TrailName string
    The name of the trail for which you want to create a historical event delivery task.
    trailName String
    The name of the trail for which you want to create a historical event delivery task.
    trailName string
    The name of the trail for which you want to create a historical event delivery task.
    trail_name str
    The name of the trail for which you want to create a historical event delivery task.
    trailName String
    The name of the trail for which you want to create a historical event delivery task.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the HistoryDeliveryJob resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    id String
    The provider-assigned unique ID for this managed resource.
    status Integer
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    id string
    The provider-assigned unique ID for this managed resource.
    status number
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    id str
    The provider-assigned unique ID for this managed resource.
    status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    id String
    The provider-assigned unique ID for this managed resource.
    status Number
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.

    Look up Existing HistoryDeliveryJob Resource

    Get an existing HistoryDeliveryJob resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: HistoryDeliveryJobState, opts?: CustomResourceOptions): HistoryDeliveryJob
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            status: Optional[int] = None,
            trail_name: Optional[str] = None) -> HistoryDeliveryJob
    func GetHistoryDeliveryJob(ctx *Context, name string, id IDInput, state *HistoryDeliveryJobState, opts ...ResourceOption) (*HistoryDeliveryJob, error)
    public static HistoryDeliveryJob Get(string name, Input<string> id, HistoryDeliveryJobState? state, CustomResourceOptions? opts = null)
    public static HistoryDeliveryJob get(String name, Output<String> id, HistoryDeliveryJobState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    TrailName string
    The name of the trail for which you want to create a historical event delivery task.
    Status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    TrailName string
    The name of the trail for which you want to create a historical event delivery task.
    status Integer
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    trailName String
    The name of the trail for which you want to create a historical event delivery task.
    status number
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    trailName string
    The name of the trail for which you want to create a historical event delivery task.
    status int
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    trail_name str
    The name of the trail for which you want to create a historical event delivery task.
    status Number
    The status of the task. Valid values: 0, 1, 2, 3. 0: The task is initializing. 1: The task is delivering historical events. 2: The delivery of historical events is complete. 3: The task fails.
    trailName String
    The name of the trail for which you want to create a historical event delivery task.

    Import

    Actiontrail History Delivery Job can be imported using the id, e.g.

    $ pulumi import alicloud:actiontrail/historyDeliveryJob:HistoryDeliveryJob example <id>
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi