func (k *KinesisOutput) InitAWS() *aws.Config {
	var creds *credentials.Credentials

	if k.config.AccessKeyID != "" && k.config.SecretAccessKey != "" {
		creds = credentials.NewStaticCredentials(k.config.AccessKeyID, k.config.SecretAccessKey, "")
	} else {
		creds = credentials.NewEC2RoleCredentials(&http.Client{Timeout: 10 * time.Second}, "", 0)
	}
	return &aws.Config{
		Region:      k.config.Region,
		Credentials: creds,
	}
}
Пример #2
0
func (k *KinesisOutput) Init(config interface{}) error {
	var creds *credentials.Credentials

	k.config = config.(*KinesisOutputConfig)

	if k.config.AccessKeyID != "" && k.config.SecretAccessKey != "" {
		creds = credentials.NewStaticCredentials(k.config.AccessKeyID, k.config.SecretAccessKey, "")
	} else {
		creds = credentials.NewEC2RoleCredentials(&http.Client{Timeout: 10 * time.Second}, "", 0)
	}
	conf := &aws.Config{
		Region:      k.config.Region,
		Credentials: creds,
	}
	k.Client = kin.New(conf)

	return nil
}