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

alicloud.actiontrail.HistoryDeliveryJob

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 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.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const example = alicloud.getRegions({
        current: true,
    });
    const exampleGetAccount = alicloud.getAccount({});
    const exampleProject = new alicloud.log.Project("example", {
        projectName: `${name}-${_default.result}`,
        description: "tf actiontrail example",
    });
    const exampleTrail = new alicloud.actiontrail.Trail("example", {
        trailName: `${name}-${_default.result}`,
        slsProjectArn: pulumi.all([example, exampleGetAccount, exampleProject.name]).apply(([example, exampleGetAccount, name]) => `acs:log:${example.regions?.[0]?.id}:${exampleGetAccount.id}:project/${name}`),
    });
    const exampleHistoryDeliveryJob = new alicloud.actiontrail.HistoryDeliveryJob("example", {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.index.Integer("default",
        min=10000,
        max=99999)
    example = alicloud.get_regions(current=True)
    example_get_account = alicloud.get_account()
    example_project = alicloud.log.Project("example",
        project_name=f"{name}-{default['result']}",
        description="tf actiontrail example")
    example_trail = alicloud.actiontrail.Trail("example",
        trail_name=f"{name}-{default['result']}",
        sls_project_arn=example_project.name.apply(lambda name: f"acs:log:{example.regions[0].id}:{example_get_account.id}:project/{name}"))
    example_history_delivery_job = alicloud.actiontrail.HistoryDeliveryJob("example", 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.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		example, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGetAccount, err := alicloud.GetAccount(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		exampleProject, err := log.NewProject(ctx, "example", &log.ProjectArgs{
    			ProjectName: pulumi.String(fmt.Sprintf("%v-%v", name, _default.Result)),
    			Description: pulumi.String("tf actiontrail example"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleTrail, err := actiontrail.NewTrail(ctx, "example", &actiontrail.TrailArgs{
    			TrailName: pulumi.String(fmt.Sprintf("%v-%v", name, _default.Result)),
    			SlsProjectArn: exampleProject.Name.ApplyT(func(name string) (string, error) {
    				return fmt.Sprintf("acs:log:%v:%v:project/%v", example.Regions[0].Id, exampleGetAccount.Id, name), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = actiontrail.NewHistoryDeliveryJob(ctx, "example", &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.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var example = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var exampleGetAccount = AliCloud.GetAccount.Invoke();
    
        var exampleProject = new AliCloud.Log.Project("example", new()
        {
            ProjectName = $"{name}-{@default.Result}",
            Description = "tf actiontrail example",
        });
    
        var exampleTrail = new AliCloud.ActionTrail.Trail("example", new()
        {
            TrailName = $"{name}-{@default.Result}",
            SlsProjectArn = Output.Tuple(example, exampleGetAccount, exampleProject.Name).Apply(values =>
            {
                var example = values.Item1;
                var exampleGetAccount = values.Item2;
                var name = values.Item3;
                return $"acs:log:{example.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:{exampleGetAccount.Apply(getAccountResult => getAccountResult.Id)}:project/{name}";
            }),
        });
    
        var exampleHistoryDeliveryJob = new AliCloud.ActionTrail.HistoryDeliveryJob("example", new()
        {
            TrailName = exampleTrail.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    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 Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            final var example = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            final var exampleGetAccount = AlicloudFunctions.getAccount();
    
            var exampleProject = new Project("exampleProject", ProjectArgs.builder()
                .projectName(String.format("%s-%s", name,default_.result()))
                .description("tf actiontrail example")
                .build());
    
            var exampleTrail = new Trail("exampleTrail", TrailArgs.builder()
                .trailName(String.format("%s-%s", name,default_.result()))
                .slsProjectArn(exampleProject.name().applyValue(name -> String.format("acs:log:%s:%s:project/%s", example.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),exampleGetAccount.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:integer
        properties:
          min: 10000
          max: 99999
      exampleProject:
        type: alicloud:log:Project
        name: example
        properties:
          projectName: ${name}-${default.result}
          description: tf actiontrail example
      exampleTrail:
        type: alicloud:actiontrail:Trail
        name: example
        properties:
          trailName: ${name}-${default.result}
          slsProjectArn: acs:log:${example.regions[0].id}:${exampleGetAccount.id}:project/${exampleProject.name}
      exampleHistoryDeliveryJob:
        type: alicloud:actiontrail:HistoryDeliveryJob
        name: example
        properties:
          trailName: ${exampleTrail.id}
    variables:
      example:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
      exampleGetAccount:
        fn::invoke:
          Function: alicloud:getAccount
          Arguments: {}
    

    Create HistoryDeliveryJob Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new HistoryDeliveryJob(name: string, args: HistoryDeliveryJobArgs, opts?: CustomResourceOptions);
    @overload
    def HistoryDeliveryJob(resource_name: str,
                           args: HistoryDeliveryJobArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def HistoryDeliveryJob(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           trail_name: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var historyDeliveryJobResource = new AliCloud.ActionTrail.HistoryDeliveryJob("historyDeliveryJobResource", new()
    {
        TrailName = "string",
    });
    
    example, err := actiontrail.NewHistoryDeliveryJob(ctx, "historyDeliveryJobResource", &actiontrail.HistoryDeliveryJobArgs{
    	TrailName: pulumi.String("string"),
    })
    
    var historyDeliveryJobResource = new HistoryDeliveryJob("historyDeliveryJobResource", HistoryDeliveryJobArgs.builder()
        .trailName("string")
        .build());
    
    history_delivery_job_resource = alicloud.actiontrail.HistoryDeliveryJob("historyDeliveryJobResource", trail_name="string")
    
    const historyDeliveryJobResource = new alicloud.actiontrail.HistoryDeliveryJob("historyDeliveryJobResource", {trailName: "string"});
    
    type: alicloud:actiontrail:HistoryDeliveryJob
    properties:
        trailName: string
    

    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>
    

    To learn more about importing existing cloud resources, see Importing resources.

    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