Skip to content

Commit

Permalink
rename fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-henglu committed May 19, 2022
1 parent 536823a commit 98531e2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource {
ValidateFunc: validate.SpringCloudAppID,
},

"routes": {
"route": {
Type: pluginsdk.TypeSet,
Optional: true,
Elem: &pluginsdk.Resource{
Expand Down Expand Up @@ -89,7 +89,7 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource {
},
},

"sso_enabled": {
"sso_validation_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
},
Expand All @@ -111,7 +111,7 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource {
ValidateFunc: validation.IsURLWithHTTPorHTTPS,
},

"tags": {
"classification_tags": {
Type: pluginsdk.TypeSet,
Optional: true,
Elem: &pluginsdk.Schema{
Expand Down Expand Up @@ -152,7 +152,7 @@ func resourceSpringCloudGatewayRouteConfigCreateUpdate(d *pluginsdk.ResourceData
gatewayRouteConfigResource := appplatform.GatewayRouteConfigResource{
Properties: &appplatform.GatewayRouteConfigProperties{
AppResourceID: utils.String(d.Get("spring_cloud_app_id").(string)),
Routes: expandGatewayRouteConfigGatewayAPIRouteArray(d.Get("routes").(*pluginsdk.Set).List()),
Routes: expandGatewayRouteConfigGatewayAPIRouteArray(d.Get("route").(*pluginsdk.Set).List()),
},
}
future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SpringName, id.GatewayName, id.RouteConfigName, gatewayRouteConfigResource)
Expand Down Expand Up @@ -191,8 +191,8 @@ func resourceSpringCloudGatewayRouteConfigRead(d *pluginsdk.ResourceData, meta i
d.Set("spring_cloud_gateway_id", parse.NewSpringCloudGatewayID(id.SubscriptionId, id.ResourceGroup, id.SpringName, id.GatewayName).ID())
if props := resp.Properties; props != nil {
d.Set("spring_cloud_app_id", props.AppResourceID)
if err := d.Set("routes", flattenGatewayRouteConfigGatewayAPIRouteArray(props.Routes)); err != nil {
return fmt.Errorf("setting `routes`: %+v", err)
if err := d.Set("route", flattenGatewayRouteConfigGatewayAPIRouteArray(props.Routes)); err != nil {
return fmt.Errorf("setting `route`: %+v", err)
}
}
return nil
Expand Down Expand Up @@ -227,12 +227,12 @@ func expandGatewayRouteConfigGatewayAPIRouteArray(input []interface{}) *[]apppla
Title: utils.String(v["title"].(string)),
Description: utils.String(v["description"].(string)),
URI: utils.String(v["uri"].(string)),
SsoEnabled: utils.Bool(v["sso_enabled"].(bool)),
SsoEnabled: utils.Bool(v["sso_validation_enabled"].(bool)),
TokenRelay: utils.Bool(v["token_relay"].(bool)),
Predicates: utils.ExpandStringSlice(v["predicates"].(*pluginsdk.Set).List()),
Filters: utils.ExpandStringSlice(v["filters"].(*pluginsdk.Set).List()),
Order: utils.Int32(int32(v["order"].(int))),
Tags: utils.ExpandStringSlice(v["tags"].(*pluginsdk.Set).List()),
Tags: utils.ExpandStringSlice(v["classification_tags"].(*pluginsdk.Set).List()),
})
}
return &results
Expand Down Expand Up @@ -270,15 +270,15 @@ func flattenGatewayRouteConfigGatewayAPIRouteArray(input *[]appplatform.GatewayA
uri = *item.URI
}
results = append(results, map[string]interface{}{
"description": description,
"filters": utils.FlattenStringSlice(item.Filters),
"order": order,
"predicates": utils.FlattenStringSlice(item.Predicates),
"sso_enabled": ssoEnabled,
"title": title,
"token_relay": tokenRelay,
"uri": uri,
"tags": utils.FlattenStringSlice(item.Tags),
"description": description,
"filters": utils.FlattenStringSlice(item.Filters),
"order": order,
"predicates": utils.FlattenStringSlice(item.Predicates),
"sso_validation_enabled": ssoEnabled,
"title": title,
"token_relay": tokenRelay,
"uri": uri,
"classification_tags": utils.FlattenStringSlice(item.Tags),
})
}
return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ resource "azurerm_spring_cloud_gateway_route_config" "test" {
name = "acctest-agrc-%d"
spring_cloud_gateway_id = azurerm_spring_cloud_gateway.test.id
spring_cloud_app_id = azurerm_spring_cloud_app.test.id
routes {
description = "test description"
filters = ["StripPrefix=2", "RateLimit=1,1s"]
order = 1
predicates = ["Path=/api5/customer/**"]
sso_enabled = true
title = "myApp route config"
token_relay = true
uri = "https://www.test.com"
tags = ["tag1", "tag2"]
route {
description = "test description"
filters = ["StripPrefix=2", "RateLimit=1,1s"]
order = 1
predicates = ["Path=/api5/customer/**"]
sso_validation_enabled = true
title = "myApp route config"
token_relay = true
uri = "https://www.test.com"
classification_tags = ["tag1", "tag2"]
}
}
`, template, data.RandomInteger)
Expand Down
28 changes: 14 additions & 14 deletions website/docs/r/spring_cloud_gateway_route_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ resource "azurerm_spring_cloud_gateway_route_config" "example" {
name = "example"
spring_cloud_gateway_id = azurerm_spring_cloud_gateway.example.id
spring_cloud_app_id = azurerm_spring_cloud_app.example.id
routes {
description = "example description"
filters = ["StripPrefix=2", "RateLimit=1,1s"]
order = 1
predicates = ["Path=/api5/customer/**"]
sso_enabled = true
title = "myApp route config"
token_relay = true
uri = "https://www.example.com"
tags = ["tag1", "tag2"]
route {
description = "example description"
filters = ["StripPrefix=2", "RateLimit=1,1s"]
order = 1
predicates = ["Path=/api5/customer/**"]
sso_validation_enabled = true
title = "myApp route config"
token_relay = true
uri = "https://www.example.com"
classification_tags = ["tag1", "tag2"]
}
}
```
Expand All @@ -62,13 +62,13 @@ The following arguments are supported:

---

* `routes` - (Optional) One or more `routes` blocks as defined below.
* `route` - (Optional) One or more `route` blocks as defined below.

* `spring_cloud_app_id` - (Optional) The ID of the Spring Cloud App.

---

A `routes` block supports the following:
A `route` block supports the following:

* `description` - (Optional) Specifies the description which will be applied to methods in the generated OpenAPI documentation.

Expand All @@ -78,9 +78,9 @@ A `routes` block supports the following:

* `predicates` - (Optional) Specifies a list of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request.

* `sso_enabled` - (Optional) Should the sso validation be enabled?
* `sso_validation_enabled` - (Optional) Should the sso validation be enabled?

* `tags` - (Optional) Specifies the classification tags which will be applied to methods in the generated OpenAPI documentation.
* `classification_tags` - (Optional) Specifies the classification tags which will be applied to methods in the generated OpenAPI documentation.

* `title` - (Optional) Specifies the title which will be applied to methods in the generated OpenAPI documentation.

Expand Down

0 comments on commit 98531e2

Please sign in to comment.