本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudtrail.CreateTrailInput类的典型用法代码示例。如果您正苦于以下问题:Golang CreateTrailInput类的具体用法?Golang CreateTrailInput怎么用?Golang CreateTrailInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTrailInput类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: resourceAwsCloudTrailCreate
func resourceAwsCloudTrailCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).cloudtrailconn
input := cloudtrail.CreateTrailInput{
Name: aws.String(d.Get("name").(string)),
S3BucketName: aws.String(d.Get("s3_bucket_name").(string)),
}
if v, ok := d.GetOk("cloud_watch_logs_group_arn"); ok {
input.CloudWatchLogsLogGroupArn = aws.String(v.(string))
}
if v, ok := d.GetOk("cloud_watch_logs_role_arn"); ok {
input.CloudWatchLogsRoleArn = aws.String(v.(string))
}
if v, ok := d.GetOk("include_global_service_events"); ok {
input.IncludeGlobalServiceEvents = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("is_multi_region_trail"); ok {
input.IsMultiRegionTrail = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("enable_log_file_validation"); ok {
input.EnableLogFileValidation = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("kms_key_id"); ok {
input.KmsKeyId = aws.String(v.(string))
}
if v, ok := d.GetOk("s3_key_prefix"); ok {
input.S3KeyPrefix = aws.String(v.(string))
}
if v, ok := d.GetOk("sns_topic_name"); ok {
input.SnsTopicName = aws.String(v.(string))
}
t, err := conn.CreateTrail(&input)
if err != nil {
return err
}
log.Printf("[DEBUG] CloudTrail created: %s", t)
d.Set("arn", *t.TrailARN)
d.SetId(*t.Name)
// AWS CloudTrail sets newly-created trails to false.
if v, ok := d.GetOk("enable_logging"); ok && v.(bool) {
err := cloudTrailSetLogging(conn, v.(bool), d.Id())
if err != nil {
return err
}
}
return resourceAwsCloudTrailUpdate(d, meta)
}
开发者ID:Originate,项目名称:terraform,代码行数:53,代码来源:resource_aws_cloudtrail.go
示例2: resourceAwsCloudTrailCreate
func resourceAwsCloudTrailCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).cloudtrailconn
input := cloudtrail.CreateTrailInput{
Name: aws.String(d.Get("name").(string)),
S3BucketName: aws.String(d.Get("s3_bucket_name").(string)),
}
if v, ok := d.GetOk("cloud_watch_logs_group_arn"); ok {
input.CloudWatchLogsLogGroupArn = aws.String(v.(string))
}
if v, ok := d.GetOk("cloud_watch_logs_role_arn"); ok {
input.CloudWatchLogsRoleArn = aws.String(v.(string))
}
if v, ok := d.GetOk("include_global_service_events"); ok {
input.IncludeGlobalServiceEvents = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("s3_key_prefix"); ok {
input.S3KeyPrefix = aws.String(v.(string))
}
if v, ok := d.GetOk("sns_topic_name"); ok {
input.SnsTopicName = aws.String(v.(string))
}
t, err := conn.CreateTrail(&input)
if err != nil {
return err
}
log.Printf("[DEBUG] CloudTrail created: %s", t)
d.SetId(*t.Name)
return resourceAwsCloudTrailRead(d, meta)
}
开发者ID:morts1a,项目名称:terraform,代码行数:35,代码来源:resource_aws_cloudtrail.go
注:本文中的github.com/aws/aws-sdk-go/service/cloudtrail.CreateTrailInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论