Create amazoncloudconfig.json
in your HOME/.gocloud directory as follows:
{
"AWSAccessKeyID": "xxxxxxxxxxxx",
"AWSSecretKey": "xxxxxxxxxxxx"
}
You can also set the credentials as environment variables:
export AWSAccessKeyID = "xxxxxxxxxxxx"
export AWSSecretKey = "xxxxxxxxxxxx"
import "github.com/cloudlibz/gocloud/gocloud"
amazoncloud, _ := gocloud.CloudProvider(gocloud.Amazonprovider)
createdns := map[string]interface{}{
"name": "rootmonk.me",
"hostedZoneConfig": "hostedZoneConfig",
}
resp, err := awsdns.CreateDns(createdns)
response := resp.(map[string]interface{})
fmt.Println(response["body"])
deletedns := map[string]string{
"ID": "ZOD7SUP0ZGGQQ",
}
resp, err := awsdns.DeleteDns(deletedns)
response := resp.(map[string]interface{})
fmt.Println(response["body"])
listdns := map[string]interface{}{
"marker": "",
"maxItems": 2,
}
resp, err := awsdns.ListDns(listdns)
response := resp.(map[string]interface{})
fmt.Println(response["body"])
listResourcednsRecordSets := map[string]interface{}{
"zone": "ZBNX5TIW033J2",
}
resp, err := awsdns.ListResourceDnsRecordSets(listResourcednsRecordSets)
response := resp.(map[string]interface{})
fmt.Println(response["body"])