Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

HistoryDeliveryJob

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 in 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

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleRegions = Output.Create(AliCloud.GetRegions.InvokeAsync(new AliCloud.GetRegionsArgs
        {
            Current = true,
        }));
        var exampleAccount = Output.Create(AliCloud.GetAccount.InvokeAsync());
        var exampleProject = new AliCloud.Log.Project("exampleProject", new AliCloud.Log.ProjectArgs
        {
            Description = "tf actiontrail test",
        });
        var exampleTrail = new AliCloud.ActionTrail.Trail("exampleTrail", new AliCloud.ActionTrail.TrailArgs
        {
            TrailName = "example_value",
            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.Regions?[0]?.Id}:{exampleAccount.Id}:project/{name}";
            }),
        });
        var exampleHistoryDeliveryJob = new AliCloud.ActionTrail.HistoryDeliveryJob("exampleHistoryDeliveryJob", new AliCloud.ActionTrail.HistoryDeliveryJobArgs
        {
            TrailName = exampleTrail.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/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleRegions, err := alicloud.GetRegions(ctx, &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{
			Description: pulumi.String("tf actiontrail test"),
		})
		if err != nil {
			return err
		}
		exampleTrail, err := actiontrail.NewTrail(ctx, "exampleTrail", &actiontrail.TrailArgs{
			TrailName: pulumi.String("example_value"),
			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
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

example_regions = alicloud.get_regions(current=True)
example_account = alicloud.get_account()
example_project = alicloud.log.Project("exampleProject", description="tf actiontrail test")
example_trail = alicloud.actiontrail.Trail("exampleTrail",
    trail_name="example_value",
    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)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const exampleRegions = alicloud.getRegions({
    current: true,
});
const exampleAccount = alicloud.getAccount({});
const exampleProject = new alicloud.log.Project("exampleProject", {description: "tf actiontrail test"});
const exampleTrail = new alicloud.actiontrail.Trail("exampleTrail", {
    trailName: "example_value",
    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});
resources:
  exampleProject:
    type: alicloud:log:Project
    properties:
      description: tf actiontrail test
  exampleTrail:
    type: alicloud:actiontrail:Trail
    properties:
      trailName: example_value
      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 a 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 an 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
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.