remove debug statements
This commit is contained in:
parent
ceeab2ad12
commit
edd67547bc
|
@ -1,28 +1,28 @@
|
||||||
package aws
|
package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccAWSAPIGatewayApiKey_importBasic(t *testing.T) {
|
func TestAccAWSAPIGatewayApiKey_importBasic(t *testing.T) {
|
||||||
resourceName := "aws_api_gateway_api_key.test"
|
resourceName := "aws_api_gateway_api_key.test"
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy,
|
CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSAPIGatewayApiKeyConfig,
|
Config: testAccAWSAPIGatewayApiKeyConfig,
|
||||||
},
|
},
|
||||||
|
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
ResourceName: resourceName,
|
ResourceName: resourceName,
|
||||||
ImportState: true,
|
ImportState: true,
|
||||||
ImportStateVerify: true,
|
ImportStateVerify: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ func resourceAwsApiGatewayApiKey() *schema.Resource {
|
||||||
Read: resourceAwsApiGatewayApiKeyRead,
|
Read: resourceAwsApiGatewayApiKeyRead,
|
||||||
Update: resourceAwsApiGatewayApiKeyUpdate,
|
Update: resourceAwsApiGatewayApiKeyUpdate,
|
||||||
Delete: resourceAwsApiGatewayApiKeyDelete,
|
Delete: resourceAwsApiGatewayApiKeyDelete,
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
State: schema.ImportStatePassthrough,
|
State: schema.ImportStatePassthrough,
|
||||||
},
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
|
@ -100,7 +100,7 @@ func resourceAwsApiGatewayApiKeyRead(d *schema.ResourceData, meta interface{}) e
|
||||||
d.Set("name", apiKey.Name)
|
d.Set("name", apiKey.Name)
|
||||||
d.Set("description", apiKey.Description)
|
d.Set("description", apiKey.Description)
|
||||||
d.Set("enabled", apiKey.Enabled)
|
d.Set("enabled", apiKey.Enabled)
|
||||||
d.Set("stage_key", flattenApiGatewayStageKeys(apiKey.StageKeys))
|
d.Set("stage_key", flattenApiGatewayStageKeys(apiKey.StageKeys))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/apigateway"
|
"github.com/aws/aws-sdk-go/service/apigateway"
|
||||||
"github.com/aws/aws-sdk-go/service/autoscaling"
|
"github.com/aws/aws-sdk-go/service/autoscaling"
|
||||||
|
@ -27,7 +25,6 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/service/rds"
|
"github.com/aws/aws-sdk-go/service/rds"
|
||||||
"github.com/aws/aws-sdk-go/service/redshift"
|
"github.com/aws/aws-sdk-go/service/redshift"
|
||||||
"github.com/aws/aws-sdk-go/service/route53"
|
"github.com/aws/aws-sdk-go/service/route53"
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1009,18 +1006,16 @@ func flattenAsgEnabledMetrics(list []*autoscaling.EnabledMetric) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenApiGatewayStageKeys(keys []*string) []map[string]interface{} {
|
func flattenApiGatewayStageKeys(keys []*string) []map[string]interface{} {
|
||||||
stageKeys := make([]map[string]interface{}, 0, len(keys))
|
stageKeys := make([]map[string]interface{}, 0, len(keys))
|
||||||
log.Printf("[INFO] THERE %s", spew.Sdump(keys))
|
for _, o := range keys {
|
||||||
for _, o := range keys {
|
key := make(map[string]interface{})
|
||||||
key := make(map[string]interface{})
|
parts := strings.Split(*o, "/")
|
||||||
parts := strings.Split(*o, "/")
|
key["stage_name"] = parts[1]
|
||||||
key["stage_name"] = parts[1]
|
key["rest_api_id"] = parts[0]
|
||||||
key["rest_api_id"] = parts[0]
|
|
||||||
|
|
||||||
stageKeys = append(stageKeys, key)
|
stageKeys = append(stageKeys, key)
|
||||||
}
|
}
|
||||||
log.Printf("[INFO] HERE %s", spew.Sdump(stageKeys))
|
return stageKeys
|
||||||
return stageKeys
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func expandApiGatewayStageKeys(d *schema.ResourceData) []*apigateway.StageKey {
|
func expandApiGatewayStageKeys(d *schema.ResourceData) []*apigateway.StageKey {
|
||||||
|
|
|
@ -961,32 +961,32 @@ func TestFlattenApiGatewayThrottleSettings(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFlattenApiGatewayStageKeys(t *testing.T) {
|
func TestFlattenApiGatewayStageKeys(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Input []*string
|
Input []*string
|
||||||
Output []map[string]interface{}
|
Output []map[string]interface{}
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Input: []*string{
|
Input: []*string{
|
||||||
aws.String("a1b2c3d4e5/dev"),
|
aws.String("a1b2c3d4e5/dev"),
|
||||||
aws.String("e5d4c3b2a1/test"),
|
aws.String("e5d4c3b2a1/test"),
|
||||||
},
|
},
|
||||||
Output: []map[string]interface{}{
|
Output: []map[string]interface{}{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"stage_name": "dev",
|
"stage_name": "dev",
|
||||||
"rest_api_id": "a1b2c3d4e5",
|
"rest_api_id": "a1b2c3d4e5",
|
||||||
},
|
},
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"stage_name": "test",
|
"stage_name": "test",
|
||||||
"rest_api_id": "e5d4c3b2a1",
|
"rest_api_id": "e5d4c3b2a1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
output := flattenApiGatewayStageKeys(tc.Input)
|
output := flattenApiGatewayStageKeys(tc.Input)
|
||||||
if !reflect.DeepEqual(output, tc.Output) {
|
if !reflect.DeepEqual(output, tc.Output) {
|
||||||
t.Fatalf("Got:\n\n%#v\n\nExpected:\n\n%#v", output, tc.Output)
|
t.Fatalf("Got:\n\n%#v\n\nExpected:\n\n%#v", output, tc.Output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue