From fa0d6af524dcaf3aa01874a09d048d303e43945f Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Sun, 6 Mar 2016 09:20:13 +0000 Subject: [PATCH] provider/aws: Remove unnecessary GetChange in Delete funcs --- .../resource_aws_api_gateway_integration.go | 20 +++----------- ...ce_aws_api_gateway_integration_response.go | 26 +++---------------- .../aws/resource_aws_api_gateway_method.go | 20 +++----------- ...esource_aws_api_gateway_method_response.go | 26 +++---------------- 4 files changed, 14 insertions(+), 78 deletions(-) diff --git a/builtin/providers/aws/resource_aws_api_gateway_integration.go b/builtin/providers/aws/resource_aws_api_gateway_integration.go index b9bbae20d9..01e90968f2 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_integration.go +++ b/builtin/providers/aws/resource_aws_api_gateway_integration.go @@ -161,25 +161,11 @@ func resourceAwsApiGatewayIntegrationDelete(d *schema.ResourceData, meta interfa conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Deleting API Gateway Integration: %s", d.Id()) - resourceId := d.Get("resource_id").(string) - if o, n := d.GetChange("resource_id"); o.(string) != n.(string) { - resourceId = o.(string) - } - httpMethod := d.Get("http_method").(string) - if o, n := d.GetChange("http_method"); o.(string) != n.(string) { - httpMethod = o.(string) - } - restApiID := d.Get("rest_api_id").(string) - if o, n := d.GetChange("rest_api_id"); o.(string) != n.(string) { - restApiID = o.(string) - } - return resource.Retry(5*time.Minute, func() error { - log.Printf("[DEBUG] schema is %#v", d) _, err := conn.DeleteIntegration(&apigateway.DeleteIntegrationInput{ - HttpMethod: aws.String(httpMethod), - ResourceId: aws.String(resourceId), - RestApiId: aws.String(restApiID), + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), }) if err == nil { return nil diff --git a/builtin/providers/aws/resource_aws_api_gateway_integration_response.go b/builtin/providers/aws/resource_aws_api_gateway_integration_response.go index 48500ab446..c8b629a69c 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_integration_response.go +++ b/builtin/providers/aws/resource_aws_api_gateway_integration_response.go @@ -116,30 +116,12 @@ func resourceAwsApiGatewayIntegrationResponseDelete(d *schema.ResourceData, meta conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Deleting API Gateway Integration Response: %s", d.Id()) - resourceId := d.Get("resource_id").(string) - if o, n := d.GetChange("resource_id"); o.(string) != n.(string) { - resourceId = o.(string) - } - httpMethod := d.Get("http_method").(string) - if o, n := d.GetChange("http_method"); o.(string) != n.(string) { - httpMethod = o.(string) - } - restApiID := d.Get("rest_api_id").(string) - if o, n := d.GetChange("rest_api_id"); o.(string) != n.(string) { - restApiID = o.(string) - } - statusCode := d.Get("status_code").(string) - if o, n := d.GetChange("status_code"); o.(string) != n.(string) { - statusCode = o.(string) - } - return resource.Retry(5*time.Minute, func() error { - log.Printf("[DEBUG] schema is %#v", d) _, err := conn.DeleteIntegrationResponse(&apigateway.DeleteIntegrationResponseInput{ - HttpMethod: aws.String(httpMethod), - ResourceId: aws.String(resourceId), - RestApiId: aws.String(restApiID), - StatusCode: aws.String(statusCode), + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), + StatusCode: aws.String(d.Get("status_code").(string)), }) if err == nil { return nil diff --git a/builtin/providers/aws/resource_aws_api_gateway_method.go b/builtin/providers/aws/resource_aws_api_gateway_method.go index 36e1236576..c5c1da391e 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_method.go +++ b/builtin/providers/aws/resource_aws_api_gateway_method.go @@ -154,25 +154,11 @@ func resourceAwsApiGatewayMethodDelete(d *schema.ResourceData, meta interface{}) conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Deleting API Gateway Method: %s", d.Id()) - resourceId := d.Get("resource_id").(string) - if o, n := d.GetChange("resource_id"); o.(string) != n.(string) { - resourceId = o.(string) - } - httpMethod := d.Get("http_method").(string) - if o, n := d.GetChange("http_method"); o.(string) != n.(string) { - httpMethod = o.(string) - } - restApiID := d.Get("rest_api_id").(string) - if o, n := d.GetChange("rest_api_id"); o.(string) != n.(string) { - restApiID = o.(string) - } - return resource.Retry(5*time.Minute, func() error { - log.Printf("[DEBUG] schema is %#v", d) _, err := conn.DeleteMethod(&apigateway.DeleteMethodInput{ - HttpMethod: aws.String(httpMethod), - ResourceId: aws.String(resourceId), - RestApiId: aws.String(restApiID), + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), }) if err == nil { return nil diff --git a/builtin/providers/aws/resource_aws_api_gateway_method_response.go b/builtin/providers/aws/resource_aws_api_gateway_method_response.go index 41b35159a7..3d77b2ea74 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_method_response.go +++ b/builtin/providers/aws/resource_aws_api_gateway_method_response.go @@ -136,30 +136,12 @@ func resourceAwsApiGatewayMethodResponseDelete(d *schema.ResourceData, meta inte conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Deleting API Gateway Method Response: %s", d.Id()) - resourceId := d.Get("resource_id").(string) - if o, n := d.GetChange("resource_id"); o.(string) != n.(string) { - resourceId = o.(string) - } - httpMethod := d.Get("http_method").(string) - if o, n := d.GetChange("http_method"); o.(string) != n.(string) { - httpMethod = o.(string) - } - restApiID := d.Get("rest_api_id").(string) - if o, n := d.GetChange("rest_api_id"); o.(string) != n.(string) { - restApiID = o.(string) - } - statusCode := d.Get("status_code").(string) - if o, n := d.GetChange("status_code"); o.(string) != n.(string) { - statusCode = o.(string) - } - return resource.Retry(5*time.Minute, func() error { - log.Printf("[DEBUG] schema is %#v", d) _, err := conn.DeleteMethodResponse(&apigateway.DeleteMethodResponseInput{ - HttpMethod: aws.String(httpMethod), - ResourceId: aws.String(resourceId), - RestApiId: aws.String(restApiID), - StatusCode: aws.String(statusCode), + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), + StatusCode: aws.String(d.Get("status_code").(string)), }) if err == nil { return nil