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