provider/aws: Remove unnecessary GetChange in Delete funcs

This commit is contained in:
Radek Simko 2016-03-06 09:20:13 +00:00
parent b12d906258
commit fa0d6af524
4 changed files with 14 additions and 78 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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