Пример #1
0
func getKinesis(route *router.Route) *kinesis.Kinesis {
	var auth *kinesis.AuthCredentials
	var err error

	if getEnvVar("AWS_ACCESS_KEY", "") != "" {
		// Get auth from env variables AWS_ACCESS_KEY and AWS_SECRET_KEY
		auth, err = kinesis.NewAuthFromEnv()
		if err != nil {
			fmt.Printf("Unable to retrieve authentication credentials from the environment: %v", err)
			os.Exit(1)
		}
	} else {
		// Get auth from meta-data-server
		auth, err = kinesis.NewAuthFromMetadata()
		if err != nil {
			fmt.Printf("Unable to retrieve authentication credentials from the the meta-data-server: %v", err)
			os.Exit(1)
		}
	}

	// AWS region
	aws_region := kinesis.NewRegionFromEnv()
	fmt.Printf("# KINESIS Adapter - Using region: %s\n", aws_region)

	return kinesis.New(auth, aws_region)
}
func getKinesis(route *router.Route) *kinesis.Kinesis {
	// set env variables AWS_ACCESS_KEY and AWS_SECRET_KEY AWS_REGION_NAME
	auth, err := kinesis.NewAuthFromEnv()
	if err != nil {
		fmt.Printf("Unable to retrieve authentication credentials from the environment: %v", err)
		os.Exit(1)
	}

	// AWS region
	aws_region := kinesis.NewRegionFromEnv()
	fmt.Printf("# KINESIS Adapter - Using region: %s\n", aws_region)

	return kinesis.New(auth, aws_region)
}