本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudtrail.CloudTrail类的典型用法代码示例。如果您正苦于以下问题:Golang CloudTrail类的具体用法?Golang CloudTrail怎么用?Golang CloudTrail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CloudTrail类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: cloudTrailSetLogging
func cloudTrailSetLogging(conn *cloudtrail.CloudTrail, enabled bool, id string) error {
if enabled {
log.Printf(
"[DEBUG] Starting logging on CloudTrail (%s)",
id)
StartLoggingOpts := &cloudtrail.StartLoggingInput{
Name: aws.String(id),
}
if _, err := conn.StartLogging(StartLoggingOpts); err != nil {
return fmt.Errorf(
"Error starting logging on CloudTrail (%s): %s",
id, err)
}
} else {
log.Printf(
"[DEBUG] Stopping logging on CloudTrail (%s)",
id)
StopLoggingOpts := &cloudtrail.StopLoggingInput{
Name: aws.String(id),
}
if _, err := conn.StopLogging(StopLoggingOpts); err != nil {
return fmt.Errorf(
"Error stopping logging on CloudTrail (%s): %s",
id, err)
}
}
return nil
}
开发者ID:Originate,项目名称:terraform,代码行数:29,代码来源:resource_aws_cloudtrail.go
示例2: setTagsCloudtrail
// setTags is a helper to set the tags for a resource. It expects the
// tags field to be named "tags"
func setTagsCloudtrail(conn *cloudtrail.CloudTrail, d *schema.ResourceData) error {
if d.HasChange("tags") {
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
create, remove := diffTagsCloudtrail(tagsFromMapCloudtrail(o), tagsFromMapCloudtrail(n))
// Set tags
if len(remove) > 0 {
input := cloudtrail.RemoveTagsInput{
ResourceId: aws.String(d.Get("arn").(string)),
TagsList: remove,
}
log.Printf("[DEBUG] Removing CloudTrail tags: %s", input)
_, err := conn.RemoveTags(&input)
if err != nil {
return err
}
}
if len(create) > 0 {
input := cloudtrail.AddTagsInput{
ResourceId: aws.String(d.Get("arn").(string)),
TagsList: create,
}
log.Printf("[DEBUG] Adding CloudTrail tags: %s", input)
_, err := conn.AddTags(&input)
if err != nil {
return err
}
}
}
return nil
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:36,代码来源:tagsCloudtrail.go
示例3: cloudTrailGetLoggingStatus
func cloudTrailGetLoggingStatus(conn *cloudtrail.CloudTrail, id *string) (bool, error) {
GetTrailStatusOpts := &cloudtrail.GetTrailStatusInput{
Name: id,
}
resp, err := conn.GetTrailStatus(GetTrailStatusOpts)
if err != nil {
return false, fmt.Errorf("Error retrieving logging status of CloudTrail (%s): %s", *id, err)
}
return *resp.IsLogging, err
}
开发者ID:Originate,项目名称:terraform,代码行数:11,代码来源:resource_aws_cloudtrail.go
注:本文中的github.com/aws/aws-sdk-go/service/cloudtrail.CloudTrail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论