當前位置: 首頁>>代碼示例>>Golang>>正文


Golang CreateTrailInput.IsMultiRegionTrail方法代碼示例

本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/cloudtrail.CreateTrailInput.IsMultiRegionTrail方法的典型用法代碼示例。如果您正苦於以下問題:Golang CreateTrailInput.IsMultiRegionTrail方法的具體用法?Golang CreateTrailInput.IsMultiRegionTrail怎麽用?Golang CreateTrailInput.IsMultiRegionTrail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/aws/aws-sdk-go/service/cloudtrail.CreateTrailInput的用法示例。


在下文中一共展示了CreateTrailInput.IsMultiRegionTrail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/aws/aws-sdk-go/service/cloudtrail.CreateTrailInput.IsMultiRegionTrail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。