github.com/smugmug/godynamo@v0.0.0-20151122084750-7913028f6623/tests/list_tables-livetest.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/smugmug/godynamo/conf"
     6  	"github.com/smugmug/godynamo/conf_file"
     7  	conf_iam "github.com/smugmug/godynamo/conf_iam"
     8  	list "github.com/smugmug/godynamo/endpoints/list_tables"
     9  	keepalive "github.com/smugmug/godynamo/keepalive"
    10  	"log"
    11  )
    12  
    13  func main() {
    14  	conf_file.Read()
    15  	conf.Vals.ConfLock.RLock()
    16  	if conf.Vals.Initialized == false {
    17  		panic("the conf.Vals global conf struct has not been initialized")
    18  	}
    19  
    20  	// launch a background poller to keep conns to aws alive
    21  	if conf.Vals.Network.DynamoDB.KeepAlive {
    22  		log.Printf("launching background keepalive")
    23  		go keepalive.KeepAlive([]string{})
    24  	}
    25  
    26  	// deal with iam, or not
    27  	if conf.Vals.UseIAM {
    28  		iam_ready_chan := make(chan bool)
    29  		go conf_iam.GoIAM(iam_ready_chan)
    30  		_ = <-iam_ready_chan
    31  	}
    32  	conf.Vals.ConfLock.RUnlock()
    33  
    34  	// List TABLES
    35  	var l list.ListTables
    36  	l.ExclusiveStartTableName = ""
    37  	l.Limit = 100
    38  	lbody, lcode, lerr := l.EndpointReq()
    39  	fmt.Printf("%v\n%v\n,%v\n", string(lbody), lcode, lerr)
    40  }