Created
December 11, 2014 15:58
-
-
Save ian-kent/b14f37dc2fb344add028 to your computer and use it in GitHub Desktop.
ElastiCache goamz example for DescribeReplicationGroup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/crowdmob/goamz/aws" | |
"github.com/crowdmob/goamz/elasticache" | |
) | |
func main() { | |
auth, err := aws.EnvAuth() | |
if err != nil { | |
log.Fatalf("Error getting AWS env auth: %s\n", err) | |
} | |
ec := elasticache.New(auth, aws.EUWest) | |
cc, err := ec.DescribeReplicationGroup("chdocapi-test") | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("ReplicationGroup: %+v\n", cc) | |
log.Printf("NodeGroups: %+v\n", cc.NodeGroups) | |
for _, ngm := range cc.NodeGroups[0].NodeGroupMembers { | |
log.Printf("NodeGroupMember: %+v\n", ngm) | |
log.Printf("ReadEndpoint: %+v\n", ngm.ReadEndpoint) | |
} | |
ep, err := cc.GetPrimaryNode() | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("%+v\n", ep) | |
fmt.Printf("Host: %s\nPort: %d\n", ep.Address, ep.Port) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment