Provides a Action Trail History Delivery Job resource.
Delivery History Tasks.
For information about Action Trail 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.Trailto 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";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const _default = alicloud.getRegions({
current: true,
});
const defaultGetAccount = alicloud.getAccount({});
const defaultGetRoles = alicloud.ram.getRoles({
nameRegex: "AliyunServiceRoleForActionTrail",
});
const defaultProject = new alicloud.log.Project("default", {
description: name,
projectName: name,
});
const defaultTrail = new alicloud.actiontrail.Trail("default", {
eventRw: "Write",
slsProjectArn: pulumi.all([_default, defaultGetAccount, defaultProject.projectName]).apply(([_default, defaultGetAccount, projectName]) => `acs:log:${_default.regions?.[0]?.id}:${defaultGetAccount.id}:project/${projectName}`),
trailName: name,
slsWriteRoleArn: defaultGetRoles.then(defaultGetRoles => defaultGetRoles.roles?.[0]?.arn),
trailRegion: "All",
isOrganizationTrail: false,
status: "Enable",
eventSelectors: JSON.stringify([{
ServiceName: "PDS",
}]),
dataEventTrailRegion: "cn-hangzhou",
});
const defaultHistoryDeliveryJob = new alicloud.actiontrail.HistoryDeliveryJob("default", {trailName: defaultTrail.id});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = alicloud.get_regions(current=True)
default_get_account = alicloud.get_account()
default_get_roles = alicloud.ram.get_roles(name_regex="AliyunServiceRoleForActionTrail")
default_project = alicloud.log.Project("default",
description=name,
project_name=name)
default_trail = alicloud.actiontrail.Trail("default",
event_rw="Write",
sls_project_arn=default_project.project_name.apply(lambda project_name: f"acs:log:{default.regions[0].id}:{default_get_account.id}:project/{project_name}"),
trail_name=name,
sls_write_role_arn=default_get_roles.roles[0].arn,
trail_region="All",
is_organization_trail=False,
status="Enable",
event_selectors=json.dumps([{
"ServiceName": "PDS",
}]),
data_event_trail_region="cn-hangzhou")
default_history_delivery_job = alicloud.actiontrail.HistoryDeliveryJob("default", trail_name=default_trail.id)
package main
import (
"encoding/json"
"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-alicloud/sdk/v3/go/alicloud/ram"
"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
}
_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultGetAccount, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
defaultGetRoles, err := ram.GetRoles(ctx, &ram.GetRolesArgs{
NameRegex: pulumi.StringRef("AliyunServiceRoleForActionTrail"),
}, nil)
if err != nil {
return err
}
defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
Description: pulumi.String(name),
ProjectName: pulumi.String(name),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal([]map[string]interface{}{
map[string]interface{}{
"ServiceName": "PDS",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
defaultTrail, err := actiontrail.NewTrail(ctx, "default", &actiontrail.TrailArgs{
EventRw: pulumi.String("Write"),
SlsProjectArn: defaultProject.ProjectName.ApplyT(func(projectName string) (string, error) {
return fmt.Sprintf("acs:log:%v:%v:project/%v", _default.Regions[0].Id, defaultGetAccount.Id, projectName), nil
}).(pulumi.StringOutput),
TrailName: pulumi.String(name),
SlsWriteRoleArn: pulumi.String(defaultGetRoles.Roles[0].Arn),
TrailRegion: pulumi.String("All"),
IsOrganizationTrail: pulumi.Bool(false),
Status: pulumi.String("Enable"),
EventSelectors: pulumi.String(json0),
DataEventTrailRegion: pulumi.String("cn-hangzhou"),
})
if err != nil {
return err
}
_, err = actiontrail.NewHistoryDeliveryJob(ctx, "default", &actiontrail.HistoryDeliveryJobArgs{
TrailName: defaultTrail.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var @default = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultGetAccount = AliCloud.GetAccount.Invoke();
var defaultGetRoles = AliCloud.Ram.GetRoles.Invoke(new()
{
NameRegex = "AliyunServiceRoleForActionTrail",
});
var defaultProject = new AliCloud.Log.Project("default", new()
{
Description = name,
ProjectName = name,
});
var defaultTrail = new AliCloud.ActionTrail.Trail("default", new()
{
EventRw = "Write",
SlsProjectArn = Output.Tuple(@default, defaultGetAccount, defaultProject.ProjectName).Apply(values =>
{
var @default = values.Item1;
var defaultGetAccount = values.Item2;
var projectName = values.Item3;
return $"acs:log:{@default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:{defaultGetAccount.Apply(getAccountResult => getAccountResult.Id)}:project/{projectName}";
}),
TrailName = name,
SlsWriteRoleArn = defaultGetRoles.Apply(getRolesResult => getRolesResult.Roles[0]?.Arn),
TrailRegion = "All",
IsOrganizationTrail = false,
Status = "Enable",
EventSelectors = JsonSerializer.Serialize(new[]
{
new Dictionary<string, object?>
{
["ServiceName"] = "PDS",
},
}),
DataEventTrailRegion = "cn-hangzhou",
});
var defaultHistoryDeliveryJob = new AliCloud.ActionTrail.HistoryDeliveryJob("default", new()
{
TrailName = defaultTrail.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.alicloud.ram.RamFunctions;
import com.pulumi.alicloud.ram.inputs.GetRolesArgs;
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 static com.pulumi.codegen.internal.Serialization.*;
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");
final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
final var defaultGetAccount = AlicloudFunctions.getAccount(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
final var defaultGetRoles = RamFunctions.getRoles(GetRolesArgs.builder()
.nameRegex("AliyunServiceRoleForActionTrail")
.build());
var defaultProject = new Project("defaultProject", ProjectArgs.builder()
.description(name)
.projectName(name)
.build());
var defaultTrail = new Trail("defaultTrail", TrailArgs.builder()
.eventRw("Write")
.slsProjectArn(defaultProject.projectName().applyValue(_projectName -> String.format("acs:log:%s:%s:project/%s", default_.regions()[0].id(),defaultGetAccount.id(),_projectName)))
.trailName(name)
.slsWriteRoleArn(defaultGetRoles.roles()[0].arn())
.trailRegion("All")
.isOrganizationTrail(false)
.status("Enable")
.eventSelectors(serializeJson(
jsonArray(jsonObject(
jsonProperty("ServiceName", "PDS")
))))
.dataEventTrailRegion("cn-hangzhou")
.build());
var defaultHistoryDeliveryJob = new HistoryDeliveryJob("defaultHistoryDeliveryJob", HistoryDeliveryJobArgs.builder()
.trailName(defaultTrail.id())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
defaultProject:
type: alicloud:log:Project
name: default
properties:
description: ${name}
projectName: ${name}
defaultTrail:
type: alicloud:actiontrail:Trail
name: default
properties:
eventRw: Write
slsProjectArn: acs:log:${default.regions[0].id}:${defaultGetAccount.id}:project/${defaultProject.projectName}
trailName: ${name}
slsWriteRoleArn: ${defaultGetRoles.roles[0].arn}
trailRegion: All
isOrganizationTrail: false
status: Enable
eventSelectors:
fn::toJSON:
- ServiceName: PDS
dataEventTrailRegion: cn-hangzhou
defaultHistoryDeliveryJob:
type: alicloud:actiontrail:HistoryDeliveryJob
name: default
properties:
trailName: ${defaultTrail.id}
variables:
default:
fn::invoke:
function: alicloud:getRegions
arguments:
current: true
defaultGetAccount:
fn::invoke:
function: alicloud:getAccount
arguments: {}
defaultGetRoles:
fn::invoke:
function: alicloud:ram:getRoles
arguments:
nameRegex: AliyunServiceRoleForActionTrail
📚 Need more examples? VIEW MORE EXAMPLES
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The HistoryDeliveryJob resource accepts the following input properties:
- Trail
Name string - The Track Name.
- Trail
Name string - The Track Name.
- trail
Name String - The Track Name.
- trail
Name string - The Track Name.
- trail_
name str - The Track Name.
- trail
Name String - The Track Name.
Outputs
All input properties are implicitly available as output properties. Additionally, the HistoryDeliveryJob resource produces the following output properties:
- Create
Time string - The creation time of the resource
- Id string
- The provider-assigned unique ID for this managed resource.
- Status int
- The status of the resource
- Create
Time string - The creation time of the resource
- Id string
- The provider-assigned unique ID for this managed resource.
- Status int
- The status of the resource
- create
Time String - The creation time of the resource
- id String
- The provider-assigned unique ID for this managed resource.
- status Integer
- The status of the resource
- create
Time string - The creation time of the resource
- id string
- The provider-assigned unique ID for this managed resource.
- status number
- The status of the resource
- create_
time str - The creation time of the resource
- id str
- The provider-assigned unique ID for this managed resource.
- status int
- The status of the resource
- create
Time String - The creation time of the resource
- id String
- The provider-assigned unique ID for this managed resource.
- status Number
- The status of the resource
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,
create_time: Optional[str] = None,
status: Optional[int] = None,
trail_name: Optional[str] = None) -> HistoryDeliveryJobfunc 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)resources: _: type: alicloud:actiontrail:HistoryDeliveryJob get: id: ${id}- 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.
- Create
Time string - The creation time of the resource
- Status int
- The status of the resource
- Trail
Name string - The Track Name.
- Create
Time string - The creation time of the resource
- Status int
- The status of the resource
- Trail
Name string - The Track Name.
- create
Time String - The creation time of the resource
- status Integer
- The status of the resource
- trail
Name String - The Track Name.
- create
Time string - The creation time of the resource
- status number
- The status of the resource
- trail
Name string - The Track Name.
- create_
time str - The creation time of the resource
- status int
- The status of the resource
- trail_
name str - The Track Name.
- create
Time String - The creation time of the resource
- status Number
- The status of the resource
- trail
Name String - The Track Name.
Import
Action Trail 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
alicloudTerraform Provider.
