Exemple #1
0
func main() {
	flag.Parse()

	config, err := LoadConfig(configFilePath)
	if err != nil {
		log.Fatalf("Error loading config file: %s", err)
	}

	logger := buildLogger(config.LogLevel)

	awsConfig := aws.NewConfig().WithRegion(config.RDSConfig.Region)
	awsSession := session.New(awsConfig)

	iamsvc := iam.New(awsSession)
	rdssvc := rds.New(awsSession)
	dbInstance := awsrds.NewRDSDBInstance(config.RDSConfig.Region, iamsvc, rdssvc, logger)
	dbCluster := awsrds.NewRDSDBCluster(config.RDSConfig.Region, iamsvc, rdssvc, logger)

	sqlProvider := sqlengine.NewProviderService(logger)

	serviceBroker := rdsbroker.New(config.RDSConfig, dbInstance, dbCluster, sqlProvider, logger)

	credentials := brokerapi.BrokerCredentials{
		Username: config.Username,
		Password: config.Password,
	}

	brokerAPI := brokerapi.New(serviceBroker, logger, credentials)
	http.Handle("/", brokerAPI)

	fmt.Println("RDS Service Broker started on port " + port + "...")
	http.ListenAndServe(":"+port, nil)
}
Exemple #2
0
func main() {
	flag.Parse()

	config, err := LoadConfig(configFilePath)
	if err != nil {
		log.Fatalf("Error loading config file: %s", err)
	}

	logger := buildLogger(config.LogLevel)

	awsConfig := aws.NewConfig().WithRegion(config.SQSConfig.Region)
	awsSession := session.New(awsConfig)

	sqssvc := sqs.New(awsSession)
	queue := awssqs.NewSQSQueue(sqssvc, logger)

	iamsvc := iam.New(awsSession)
	user := awsiam.NewIAMUser(iamsvc, logger)

	serviceBroker := sqsbroker.New(config.SQSConfig, queue, user, logger)

	credentials := brokerapi.BrokerCredentials{
		Username: config.Username,
		Password: config.Password,
	}

	brokerAPI := brokerapi.New(serviceBroker, logger, credentials)
	http.Handle("/", brokerAPI)

	fmt.Println("SQS Service Broker started on port " + port + "...")
	http.ListenAndServe(":"+port, nil)
}
// Run starts the Martini webapp handler
func (subway *Broker) Run() {
	username := os.Getenv("SUBWAY_USERNAME")
	if username == "" {
		username = "******"
	}

	password := os.Getenv("SUBWAY_PASSWORD")
	if password == "" {
		password = "******"
	}

	credentials := brokerapi.BrokerCredentials{
		Username: username,
		Password: password,
	}
	fmt.Println(credentials)

	port := os.Getenv("PORT")
	if port == "" {
		port = "3000"
	}

	brokerAPI := brokerapi.New(subway, subway.Logger, credentials)
	http.Handle("/", brokerAPI)
	subway.Logger.Fatal("http-listen", http.ListenAndServe(fmt.Sprintf("0.0.0.0:%s", port), nil))
}
func main() {
	flag.Parse()

	config, err := LoadConfig(configFilePath)
	if err != nil {
		log.Fatalf("Error loading config file: %s", err)
	}

	logger := buildLogger(config.LogLevel)

	awsConfig := aws.NewConfig().WithRegion(config.CloudFormationConfig.Region)
	awsSession := session.New(awsConfig)

	cfsvc := cloudformation.New(awsSession)
	stack := awscf.NewCloudFormationStack(cfsvc, logger)

	serviceBroker := cfbroker.New(config.CloudFormationConfig, stack, logger)

	credentials := brokerapi.BrokerCredentials{
		Username: config.Username,
		Password: config.Password,
	}

	brokerAPI := brokerapi.New(serviceBroker, logger, credentials)
	http.Handle("/", brokerAPI)

	fmt.Println("CloudFormation Service Broker started on port " + port + "...")
	http.ListenAndServe(":"+port, nil)
}
// Run starts the Martini webapp handler
func (bkr *Broker) Run() {
	credentials := brokerapi.BrokerCredentials{
		Username: bkr.config.Username,
		Password: bkr.config.Password,
	}
	port := bkr.config.Port

	brokerAPI := brokerapi.New(bkr, bkr.logger, credentials)
	http.Handle("/v2/", brokerAPI)

	adminAPI := NewAdminAPI(bkr, bkr.logger, credentials)
	http.Handle("/admin/", adminAPI)

	bkr.logger.Fatal("http-listen", http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", port), nil))
}