Conver to regular Go vendor + dep tool

This commit is contained in:
Andrey Smirnov
2017-03-22 17:38:32 +03:00
parent 070347295e
commit c6c1012330
3260 changed files with 1742550 additions and 72 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,123 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudtrailiface provides an interface to enable mocking the AWS CloudTrail service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package cloudtrailiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudtrail"
)
// CloudTrailAPI provides an interface to enable mocking the
// cloudtrail.CloudTrail service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // AWS CloudTrail.
// func myFunc(svc cloudtrailiface.CloudTrailAPI) bool {
// // Make svc.AddTags request
// }
//
// func main() {
// sess := session.New()
// svc := cloudtrail.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockCloudTrailClient struct {
// cloudtrailiface.CloudTrailAPI
// }
// func (m *mockCloudTrailClient) AddTags(input *cloudtrail.AddTagsInput) (*cloudtrail.AddTagsOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockCloudTrailClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type CloudTrailAPI interface {
AddTags(*cloudtrail.AddTagsInput) (*cloudtrail.AddTagsOutput, error)
AddTagsWithContext(aws.Context, *cloudtrail.AddTagsInput, ...request.Option) (*cloudtrail.AddTagsOutput, error)
AddTagsRequest(*cloudtrail.AddTagsInput) (*request.Request, *cloudtrail.AddTagsOutput)
CreateTrail(*cloudtrail.CreateTrailInput) (*cloudtrail.CreateTrailOutput, error)
CreateTrailWithContext(aws.Context, *cloudtrail.CreateTrailInput, ...request.Option) (*cloudtrail.CreateTrailOutput, error)
CreateTrailRequest(*cloudtrail.CreateTrailInput) (*request.Request, *cloudtrail.CreateTrailOutput)
DeleteTrail(*cloudtrail.DeleteTrailInput) (*cloudtrail.DeleteTrailOutput, error)
DeleteTrailWithContext(aws.Context, *cloudtrail.DeleteTrailInput, ...request.Option) (*cloudtrail.DeleteTrailOutput, error)
DeleteTrailRequest(*cloudtrail.DeleteTrailInput) (*request.Request, *cloudtrail.DeleteTrailOutput)
DescribeTrails(*cloudtrail.DescribeTrailsInput) (*cloudtrail.DescribeTrailsOutput, error)
DescribeTrailsWithContext(aws.Context, *cloudtrail.DescribeTrailsInput, ...request.Option) (*cloudtrail.DescribeTrailsOutput, error)
DescribeTrailsRequest(*cloudtrail.DescribeTrailsInput) (*request.Request, *cloudtrail.DescribeTrailsOutput)
GetEventSelectors(*cloudtrail.GetEventSelectorsInput) (*cloudtrail.GetEventSelectorsOutput, error)
GetEventSelectorsWithContext(aws.Context, *cloudtrail.GetEventSelectorsInput, ...request.Option) (*cloudtrail.GetEventSelectorsOutput, error)
GetEventSelectorsRequest(*cloudtrail.GetEventSelectorsInput) (*request.Request, *cloudtrail.GetEventSelectorsOutput)
GetTrailStatus(*cloudtrail.GetTrailStatusInput) (*cloudtrail.GetTrailStatusOutput, error)
GetTrailStatusWithContext(aws.Context, *cloudtrail.GetTrailStatusInput, ...request.Option) (*cloudtrail.GetTrailStatusOutput, error)
GetTrailStatusRequest(*cloudtrail.GetTrailStatusInput) (*request.Request, *cloudtrail.GetTrailStatusOutput)
ListPublicKeys(*cloudtrail.ListPublicKeysInput) (*cloudtrail.ListPublicKeysOutput, error)
ListPublicKeysWithContext(aws.Context, *cloudtrail.ListPublicKeysInput, ...request.Option) (*cloudtrail.ListPublicKeysOutput, error)
ListPublicKeysRequest(*cloudtrail.ListPublicKeysInput) (*request.Request, *cloudtrail.ListPublicKeysOutput)
ListTags(*cloudtrail.ListTagsInput) (*cloudtrail.ListTagsOutput, error)
ListTagsWithContext(aws.Context, *cloudtrail.ListTagsInput, ...request.Option) (*cloudtrail.ListTagsOutput, error)
ListTagsRequest(*cloudtrail.ListTagsInput) (*request.Request, *cloudtrail.ListTagsOutput)
LookupEvents(*cloudtrail.LookupEventsInput) (*cloudtrail.LookupEventsOutput, error)
LookupEventsWithContext(aws.Context, *cloudtrail.LookupEventsInput, ...request.Option) (*cloudtrail.LookupEventsOutput, error)
LookupEventsRequest(*cloudtrail.LookupEventsInput) (*request.Request, *cloudtrail.LookupEventsOutput)
LookupEventsPages(*cloudtrail.LookupEventsInput, func(*cloudtrail.LookupEventsOutput, bool) bool) error
LookupEventsPagesWithContext(aws.Context, *cloudtrail.LookupEventsInput, func(*cloudtrail.LookupEventsOutput, bool) bool, ...request.Option) error
PutEventSelectors(*cloudtrail.PutEventSelectorsInput) (*cloudtrail.PutEventSelectorsOutput, error)
PutEventSelectorsWithContext(aws.Context, *cloudtrail.PutEventSelectorsInput, ...request.Option) (*cloudtrail.PutEventSelectorsOutput, error)
PutEventSelectorsRequest(*cloudtrail.PutEventSelectorsInput) (*request.Request, *cloudtrail.PutEventSelectorsOutput)
RemoveTags(*cloudtrail.RemoveTagsInput) (*cloudtrail.RemoveTagsOutput, error)
RemoveTagsWithContext(aws.Context, *cloudtrail.RemoveTagsInput, ...request.Option) (*cloudtrail.RemoveTagsOutput, error)
RemoveTagsRequest(*cloudtrail.RemoveTagsInput) (*request.Request, *cloudtrail.RemoveTagsOutput)
StartLogging(*cloudtrail.StartLoggingInput) (*cloudtrail.StartLoggingOutput, error)
StartLoggingWithContext(aws.Context, *cloudtrail.StartLoggingInput, ...request.Option) (*cloudtrail.StartLoggingOutput, error)
StartLoggingRequest(*cloudtrail.StartLoggingInput) (*request.Request, *cloudtrail.StartLoggingOutput)
StopLogging(*cloudtrail.StopLoggingInput) (*cloudtrail.StopLoggingOutput, error)
StopLoggingWithContext(aws.Context, *cloudtrail.StopLoggingInput, ...request.Option) (*cloudtrail.StopLoggingOutput, error)
StopLoggingRequest(*cloudtrail.StopLoggingInput) (*request.Request, *cloudtrail.StopLoggingOutput)
UpdateTrail(*cloudtrail.UpdateTrailInput) (*cloudtrail.UpdateTrailOutput, error)
UpdateTrailWithContext(aws.Context, *cloudtrail.UpdateTrailInput, ...request.Option) (*cloudtrail.UpdateTrailOutput, error)
UpdateTrailRequest(*cloudtrail.UpdateTrailInput) (*request.Request, *cloudtrail.UpdateTrailOutput)
}
var _ CloudTrailAPI = (*cloudtrail.CloudTrail)(nil)
+245
View File
@@ -0,0 +1,245 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudtrail
const (
// ErrCodeARNInvalidException for service response error code
// "ARNInvalidException".
//
// This exception is thrown when an operation is called with an invalid trail
// ARN. The format of a trail ARN is:
//
// arn:aws:cloudtrail:us-east-1:123456789012:trail/MyTrail
ErrCodeARNInvalidException = "ARNInvalidException"
// ErrCodeCloudWatchLogsDeliveryUnavailableException for service response error code
// "CloudWatchLogsDeliveryUnavailableException".
//
// Cannot set a CloudWatch Logs delivery for this region.
ErrCodeCloudWatchLogsDeliveryUnavailableException = "CloudWatchLogsDeliveryUnavailableException"
// ErrCodeInsufficientEncryptionPolicyException for service response error code
// "InsufficientEncryptionPolicyException".
//
// This exception is thrown when the policy on the S3 bucket or KMS key is not
// sufficient.
ErrCodeInsufficientEncryptionPolicyException = "InsufficientEncryptionPolicyException"
// ErrCodeInsufficientS3BucketPolicyException for service response error code
// "InsufficientS3BucketPolicyException".
//
// This exception is thrown when the policy on the S3 bucket is not sufficient.
ErrCodeInsufficientS3BucketPolicyException = "InsufficientS3BucketPolicyException"
// ErrCodeInsufficientSnsTopicPolicyException for service response error code
// "InsufficientSnsTopicPolicyException".
//
// This exception is thrown when the policy on the SNS topic is not sufficient.
ErrCodeInsufficientSnsTopicPolicyException = "InsufficientSnsTopicPolicyException"
// ErrCodeInvalidCloudWatchLogsLogGroupArnException for service response error code
// "InvalidCloudWatchLogsLogGroupArnException".
//
// This exception is thrown when the provided CloudWatch log group is not valid.
ErrCodeInvalidCloudWatchLogsLogGroupArnException = "InvalidCloudWatchLogsLogGroupArnException"
// ErrCodeInvalidCloudWatchLogsRoleArnException for service response error code
// "InvalidCloudWatchLogsRoleArnException".
//
// This exception is thrown when the provided role is not valid.
ErrCodeInvalidCloudWatchLogsRoleArnException = "InvalidCloudWatchLogsRoleArnException"
// ErrCodeInvalidEventSelectorsException for service response error code
// "InvalidEventSelectorsException".
//
// This exception is thrown when the PutEventSelectors operation is called with
// an invalid number of event selectors, data resources, or an invalid value
// for a parameter:
//
// * Specify a valid number of event selectors (1 to 5) for a trail.
//
// * Specify a valid number of data resources (1 to 250) for an event selector.
//
// * Specify a valid value for a parameter. For example, specifying the ReadWriteType
// parameter with a value of read-only is invalid.
ErrCodeInvalidEventSelectorsException = "InvalidEventSelectorsException"
// ErrCodeInvalidHomeRegionException for service response error code
// "InvalidHomeRegionException".
//
// This exception is thrown when an operation is called on a trail from a region
// other than the region in which the trail was created.
ErrCodeInvalidHomeRegionException = "InvalidHomeRegionException"
// ErrCodeInvalidKmsKeyIdException for service response error code
// "InvalidKmsKeyIdException".
//
// This exception is thrown when the KMS key ARN is invalid.
ErrCodeInvalidKmsKeyIdException = "InvalidKmsKeyIdException"
// ErrCodeInvalidLookupAttributesException for service response error code
// "InvalidLookupAttributesException".
//
// Occurs when an invalid lookup attribute is specified.
ErrCodeInvalidLookupAttributesException = "InvalidLookupAttributesException"
// ErrCodeInvalidMaxResultsException for service response error code
// "InvalidMaxResultsException".
//
// This exception is thrown if the limit specified is invalid.
ErrCodeInvalidMaxResultsException = "InvalidMaxResultsException"
// ErrCodeInvalidNextTokenException for service response error code
// "InvalidNextTokenException".
//
// Invalid token or token that was previously used in a request with different
// parameters. This exception is thrown if the token is invalid.
ErrCodeInvalidNextTokenException = "InvalidNextTokenException"
// ErrCodeInvalidParameterCombinationException for service response error code
// "InvalidParameterCombinationException".
//
// This exception is thrown when the combination of parameters provided is not
// valid.
ErrCodeInvalidParameterCombinationException = "InvalidParameterCombinationException"
// ErrCodeInvalidS3BucketNameException for service response error code
// "InvalidS3BucketNameException".
//
// This exception is thrown when the provided S3 bucket name is not valid.
ErrCodeInvalidS3BucketNameException = "InvalidS3BucketNameException"
// ErrCodeInvalidS3PrefixException for service response error code
// "InvalidS3PrefixException".
//
// This exception is thrown when the provided S3 prefix is not valid.
ErrCodeInvalidS3PrefixException = "InvalidS3PrefixException"
// ErrCodeInvalidSnsTopicNameException for service response error code
// "InvalidSnsTopicNameException".
//
// This exception is thrown when the provided SNS topic name is not valid.
ErrCodeInvalidSnsTopicNameException = "InvalidSnsTopicNameException"
// ErrCodeInvalidTagParameterException for service response error code
// "InvalidTagParameterException".
//
// This exception is thrown when the key or value specified for the tag does
// not match the regular expression ^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$.
ErrCodeInvalidTagParameterException = "InvalidTagParameterException"
// ErrCodeInvalidTimeRangeException for service response error code
// "InvalidTimeRangeException".
//
// Occurs if the timestamp values are invalid. Either the start time occurs
// after the end time or the time range is outside the range of possible values.
ErrCodeInvalidTimeRangeException = "InvalidTimeRangeException"
// ErrCodeInvalidTokenException for service response error code
// "InvalidTokenException".
//
// Reserved for future use.
ErrCodeInvalidTokenException = "InvalidTokenException"
// ErrCodeInvalidTrailNameException for service response error code
// "InvalidTrailNameException".
//
// This exception is thrown when the provided trail name is not valid. Trail
// names must meet the following requirements:
//
// * Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores
// (_), or dashes (-)
//
// * Start with a letter or number, and end with a letter or number
//
// * Be between 3 and 128 characters
//
// * Have no adjacent periods, underscores or dashes. Names like my-_namespace
// and my--namespace are invalid.
//
// * Not be in IP address format (for example, 192.168.5.4)
ErrCodeInvalidTrailNameException = "InvalidTrailNameException"
// ErrCodeKmsException for service response error code
// "KmsException".
//
// This exception is thrown when there is an issue with the specified KMS key
// and the trail cant be updated.
ErrCodeKmsException = "KmsException"
// ErrCodeKmsKeyDisabledException for service response error code
// "KmsKeyDisabledException".
//
// This exception is deprecated.
ErrCodeKmsKeyDisabledException = "KmsKeyDisabledException"
// ErrCodeKmsKeyNotFoundException for service response error code
// "KmsKeyNotFoundException".
//
// This exception is thrown when the KMS key does not exist, or when the S3
// bucket and the KMS key are not in the same region.
ErrCodeKmsKeyNotFoundException = "KmsKeyNotFoundException"
// ErrCodeMaximumNumberOfTrailsExceededException for service response error code
// "MaximumNumberOfTrailsExceededException".
//
// This exception is thrown when the maximum number of trails is reached.
ErrCodeMaximumNumberOfTrailsExceededException = "MaximumNumberOfTrailsExceededException"
// ErrCodeOperationNotPermittedException for service response error code
// "OperationNotPermittedException".
//
// This exception is thrown when the requested operation is not permitted.
ErrCodeOperationNotPermittedException = "OperationNotPermittedException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// This exception is thrown when the specified resource is not found.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeResourceTypeNotSupportedException for service response error code
// "ResourceTypeNotSupportedException".
//
// This exception is thrown when the specified resource type is not supported
// by CloudTrail.
ErrCodeResourceTypeNotSupportedException = "ResourceTypeNotSupportedException"
// ErrCodeS3BucketDoesNotExistException for service response error code
// "S3BucketDoesNotExistException".
//
// This exception is thrown when the specified S3 bucket does not exist.
ErrCodeS3BucketDoesNotExistException = "S3BucketDoesNotExistException"
// ErrCodeTagsLimitExceededException for service response error code
// "TagsLimitExceededException".
//
// The number of tags per trail has exceeded the permitted amount. Currently,
// the limit is 50.
ErrCodeTagsLimitExceededException = "TagsLimitExceededException"
// ErrCodeTrailAlreadyExistsException for service response error code
// "TrailAlreadyExistsException".
//
// This exception is thrown when the specified trail already exists.
ErrCodeTrailAlreadyExistsException = "TrailAlreadyExistsException"
// ErrCodeTrailNotFoundException for service response error code
// "TrailNotFoundException".
//
// This exception is thrown when the trail with the given name is not found.
ErrCodeTrailNotFoundException = "TrailNotFoundException"
// ErrCodeTrailNotProvidedException for service response error code
// "TrailNotProvidedException".
//
// This exception is deprecated.
ErrCodeTrailNotProvidedException = "TrailNotProvidedException"
// ErrCodeUnsupportedOperationException for service response error code
// "UnsupportedOperationException".
//
// This exception is thrown when the requested operation is not supported.
ErrCodeUnsupportedOperationException = "UnsupportedOperationException"
)
+379
View File
@@ -0,0 +1,379 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudtrail_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudtrail"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudTrail_AddTags() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.AddTagsInput{
ResourceId: aws.String("String"), // Required
TagsList: []*cloudtrail.Tag{
{ // Required
Key: aws.String("String"), // Required
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.AddTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_CreateTrail() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.CreateTrailInput{
Name: aws.String("String"), // Required
S3BucketName: aws.String("String"), // Required
CloudWatchLogsLogGroupArn: aws.String("String"),
CloudWatchLogsRoleArn: aws.String("String"),
EnableLogFileValidation: aws.Bool(true),
IncludeGlobalServiceEvents: aws.Bool(true),
IsMultiRegionTrail: aws.Bool(true),
KmsKeyId: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicName: aws.String("String"),
}
resp, err := svc.CreateTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_DeleteTrail() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.DeleteTrailInput{
Name: aws.String("String"), // Required
}
resp, err := svc.DeleteTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_DescribeTrails() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.DescribeTrailsInput{
IncludeShadowTrails: aws.Bool(true),
TrailNameList: []*string{
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.DescribeTrails(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_GetEventSelectors() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.GetEventSelectorsInput{
TrailName: aws.String("String"),
}
resp, err := svc.GetEventSelectors(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_GetTrailStatus() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.GetTrailStatusInput{
Name: aws.String("String"), // Required
}
resp, err := svc.GetTrailStatus(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_ListPublicKeys() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.ListPublicKeysInput{
EndTime: aws.Time(time.Now()),
NextToken: aws.String("String"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.ListPublicKeys(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_ListTags() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.ListTagsInput{
ResourceIdList: []*string{ // Required
aws.String("String"), // Required
// More values...
},
NextToken: aws.String("String"),
}
resp, err := svc.ListTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_LookupEvents() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.LookupEventsInput{
EndTime: aws.Time(time.Now()),
LookupAttributes: []*cloudtrail.LookupAttribute{
{ // Required
AttributeKey: aws.String("LookupAttributeKey"), // Required
AttributeValue: aws.String("String"), // Required
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.LookupEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_PutEventSelectors() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.PutEventSelectorsInput{
EventSelectors: []*cloudtrail.EventSelector{
{ // Required
DataResources: []*cloudtrail.DataResource{
{ // Required
Type: aws.String("String"),
Values: []*string{
aws.String("String"), // Required
// More values...
},
},
// More values...
},
IncludeManagementEvents: aws.Bool(true),
ReadWriteType: aws.String("ReadWriteType"),
},
// More values...
},
TrailName: aws.String("String"),
}
resp, err := svc.PutEventSelectors(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_RemoveTags() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.RemoveTagsInput{
ResourceId: aws.String("String"), // Required
TagsList: []*cloudtrail.Tag{
{ // Required
Key: aws.String("String"), // Required
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.RemoveTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_StartLogging() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.StartLoggingInput{
Name: aws.String("String"), // Required
}
resp, err := svc.StartLogging(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_StopLogging() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.StopLoggingInput{
Name: aws.String("String"), // Required
}
resp, err := svc.StopLogging(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_UpdateTrail() {
sess := session.Must(session.NewSession())
svc := cloudtrail.New(sess)
params := &cloudtrail.UpdateTrailInput{
Name: aws.String("String"), // Required
CloudWatchLogsLogGroupArn: aws.String("String"),
CloudWatchLogsRoleArn: aws.String("String"),
EnableLogFileValidation: aws.Bool(true),
IncludeGlobalServiceEvents: aws.Bool(true),
IsMultiRegionTrail: aws.Bool(true),
KmsKeyId: aws.String("String"),
S3BucketName: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicName: aws.String("String"),
}
resp, err := svc.UpdateTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
+113
View File
@@ -0,0 +1,113 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudtrail
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// This is the CloudTrail API Reference. It provides descriptions of actions,
// data types, common parameters, and common errors for CloudTrail.
//
// CloudTrail is a web service that records AWS API calls for your AWS account
// and delivers log files to an Amazon S3 bucket. The recorded information includes
// the identity of the user, the start time of the AWS API call, the source
// IP address, the request parameters, and the response elements returned by
// the service.
//
// As an alternative to the API, you can use one of the AWS SDKs, which consist
// of libraries and sample code for various programming languages and platforms
// (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way
// to create programmatic access to AWSCloudTrail. For example, the SDKs take
// care of cryptographically signing requests, managing errors, and retrying
// requests automatically. For information about the AWS SDKs, including how
// to download and install them, see the Tools for Amazon Web Services page
// (http://aws.amazon.com/tools/).
//
// See the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)
// for information about the data that is included with each AWS API call listed
// in the log files.
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01
type CloudTrail struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "cloudtrail" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the CloudTrail client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudTrail client from just a session.
// svc := cloudtrail.New(mySession)
//
// // Create a CloudTrail client with additional configuration
// svc := cloudtrail.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudTrail {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *CloudTrail {
svc := &CloudTrail{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-11-01",
JSONVersion: "1.1",
TargetPrefix: "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudTrail operation and runs any
// custom request initialization.
func (c *CloudTrail) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}