Skip to content

Commit

Permalink
resource/aws_api_gateway_stage: Remove deprecated (helper/schema.Reso…
Browse files Browse the repository at this point in the history
…urceData).Partial() and (helper/schema.ResourceData).SetPartial() (hashicorp#12467)

Reference: hashicorp#12083
Reference: hashicorp#12087

Previously:

```
aws/resource_aws_api_gateway_stage.go:134:2: R007: deprecated (schema.ResourceData).Partial
aws/resource_aws_api_gateway_stage.go:178:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:179:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:180:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:181:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:182:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:183:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:205:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:206:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:207:2: R007: deprecated (schema.ResourceData).Partial
aws/resource_aws_api_gateway_stage.go:291:2: R007: deprecated (schema.ResourceData).Partial
aws/resource_aws_api_gateway_stage.go:398:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:399:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:400:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:401:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:402:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:428:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:429:2: R008: deprecated (schema.ResourceData).SetPartial
aws/resource_aws_api_gateway_stage.go:430:2: R007: deprecated (schema.ResourceData).Partial
```

Output from acceptance testing:

```
--- PASS: TestAccAWSAPIGatewayStage_accessLogSettings (260.87s)
--- PASS: TestAccAWSAPIGatewayStage_accessLogSettings_kinesis (388.36s)
--- PASS: TestAccAWSAPIGatewayStage_basic (469.04s)
```
  • Loading branch information
bflad authored and adamdecaf committed May 28, 2020
1 parent 9d3233a commit ac0e759
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions aws/resource_aws_api_gateway_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ func resourceAwsApiGatewayStage() *schema.Resource {
func resourceAwsApiGatewayStageCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).apigatewayconn

d.Partial(true)

input := apigateway.CreateStageInput{
RestApiId: aws.String(d.Get("rest_api_id").(string)),
StageName: aws.String(d.Get("stage_name").(string)),
Expand Down Expand Up @@ -175,13 +173,6 @@ func resourceAwsApiGatewayStageCreate(d *schema.ResourceData, meta interface{})

d.SetId(fmt.Sprintf("ags-%s-%s", d.Get("rest_api_id").(string), d.Get("stage_name").(string)))

d.SetPartial("rest_api_id")
d.SetPartial("stage_name")
d.SetPartial("deployment_id")
d.SetPartial("description")
d.SetPartial("variables")
d.SetPartial("xray_tracing_enabled")

if waitForCache && *out.CacheClusterStatus != apigateway.CacheClusterStatusNotAvailable {
stateConf := &resource.StateChangeConf{
Pending: []string{
Expand All @@ -202,10 +193,6 @@ func resourceAwsApiGatewayStageCreate(d *schema.ResourceData, meta interface{})
}
}

d.SetPartial("cache_cluster_enabled")
d.SetPartial("cache_cluster_size")
d.Partial(false)

if _, ok := d.GetOk("client_certificate_id"); ok {
return resourceAwsApiGatewayStageUpdate(d, meta)
}
Expand Down Expand Up @@ -288,8 +275,6 @@ func resourceAwsApiGatewayStageRead(d *schema.ResourceData, meta interface{}) er
func resourceAwsApiGatewayStageUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).apigatewayconn

d.Partial(true)

stageArn := arn.ARN{
Partition: meta.(*AWSClient).partition,
Region: meta.(*AWSClient).region,
Expand Down Expand Up @@ -395,12 +380,6 @@ func resourceAwsApiGatewayStageUpdate(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Updating API Gateway Stage failed: %s", err)
}

d.SetPartial("client_certificate_id")
d.SetPartial("deployment_id")
d.SetPartial("description")
d.SetPartial("xray_tracing_enabled")
d.SetPartial("variables")

if waitForCache && *out.CacheClusterStatus != apigateway.CacheClusterStatusNotAvailable {
stateConf := &resource.StateChangeConf{
Pending: []string{
Expand All @@ -425,10 +404,6 @@ func resourceAwsApiGatewayStageUpdate(d *schema.ResourceData, meta interface{})
}
}

d.SetPartial("cache_cluster_enabled")
d.SetPartial("cache_cluster_size")
d.Partial(false)

return resourceAwsApiGatewayStageRead(d, meta)
}

Expand Down

0 comments on commit ac0e759

Please sign in to comment.