Skip to content

Commit

Permalink
Resolve issue CiscoDevNet#288
Browse files Browse the repository at this point in the history
  • Loading branch information
seconroy committed Jul 19, 2024
1 parent 9a85a50 commit d126c6a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/traffic_data_policy_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Read-Only:
- `log` (Boolean) Enable logging
- `loss_correction` (String) Loss correction
- `loss_correction_fec` (String) Loss correction FEC
- `loss_correction_fec_threshold` (Number) Loss correction FEC threshold
- `loss_correction_fec_threshold` (String) Loss correction FEC threshold
- `loss_correction_packet_duplication` (String) Loss correction packet duplication
- `nat_parameters` (Attributes List) List of NAT parameters (see [below for nested schema](#nestedatt--sequences--action_entries--nat_parameters))
- `nat_pool` (String) NAT pool
Expand Down
3 changes: 1 addition & 2 deletions docs/resources/traffic_data_policy_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ Optional:
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `loss_correction_fec` (String) Loss correction FEC
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `loss_correction_fec_threshold` (Number) Loss correction FEC threshold
- Range: `1`-`5`
- `loss_correction_fec_threshold` (String) Loss correction FEC threshold
- `loss_correction_packet_duplication` (String) Loss correction packet duplication
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `nat_parameters` (Attributes List) List of NAT parameters (see [below for nested schema](#nestedatt--sequences--action_entries--nat_parameters))
Expand Down
6 changes: 3 additions & 3 deletions gen/definitions/generic/traffic_data_policy_definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ attributes:
conditional_attribute:
name: type
value: lossProtectFec
type: Int64
type: String
description: Loss correction FEC threshold
min_int: 1
max_int: 5
# min_int: 1
# max_int: 5
example: 2
exclude_test: true
- model_name: field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (d *TrafficDataPolicyDefinitionDataSource) Schema(ctx context.Context, req
MarkdownDescription: "Loss correction packet duplication",
Computed: true,
},
"loss_correction_fec_threshold": schema.Int64Attribute{
"loss_correction_fec_threshold": schema.StringAttribute{
MarkdownDescription: "Loss correction FEC threshold",
Computed: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type TrafficDataPolicyDefinitionSequencesActionEntries struct {
LossCorrection types.String `tfsdk:"loss_correction"`
LossCorrectionFec types.String `tfsdk:"loss_correction_fec"`
LossCorrectionPacketDuplication types.String `tfsdk:"loss_correction_packet_duplication"`
LossCorrectionFecThreshold types.Int64 `tfsdk:"loss_correction_fec_threshold"`
LossCorrectionFecThreshold types.String `tfsdk:"loss_correction_fec_threshold"`
NatPool types.String `tfsdk:"nat_pool"`
NatPoolId types.Int64 `tfsdk:"nat_pool_id"`
RedirectDns types.String `tfsdk:"redirect_dns"`
Expand Down Expand Up @@ -272,7 +272,7 @@ func (data TrafficDataPolicyDefinition) toBody(ctx context.Context) string {
itemChildBody, _ = sjson.Set(itemChildBody, "parameter", childItem.LossCorrectionPacketDuplication.ValueString())
}
if !childItem.LossCorrectionFecThreshold.IsNull() && childItem.Type.ValueString() == "lossProtectFec" {
itemChildBody, _ = sjson.Set(itemChildBody, "value", childItem.LossCorrectionFecThreshold.ValueInt64())
itemChildBody, _ = sjson.Set(itemChildBody, "value", childItem.LossCorrectionFecThreshold.ValueString())
}
if !childItem.NatPool.IsNull() && childItem.Type.ValueString() == "nat" {
itemChildBody, _ = sjson.Set(itemChildBody, "parameter.field", childItem.NatPool.ValueString())
Expand Down Expand Up @@ -621,9 +621,9 @@ func (data *TrafficDataPolicyDefinition) fromBody(ctx context.Context, res gjson
cItem.LossCorrectionPacketDuplication = types.StringNull()
}
if ccValue := cv.Get("value"); ccValue.Exists() && cItem.Type.ValueString() == "lossProtectFec" {
cItem.LossCorrectionFecThreshold = types.Int64Value(ccValue.Int())
cItem.LossCorrectionFecThreshold = types.StringValue(ccValue.String())
} else {
cItem.LossCorrectionFecThreshold = types.Int64Null()
cItem.LossCorrectionFecThreshold = types.StringNull()
}
if ccValue := cv.Get("parameter.field"); ccValue.Exists() && cItem.Type.ValueString() == "nat" {
cItem.NatPool = types.StringValue(ccValue.String())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,9 @@ func (r *TrafficDataPolicyDefinitionResource) Schema(ctx context.Context, req re
stringvalidator.OneOf("fecAdaptive", "fecAlways", "packetDuplication"),
},
},
"loss_correction_fec_threshold": schema.Int64Attribute{
MarkdownDescription: helpers.NewAttributeDescription("Loss correction FEC threshold").AddIntegerRangeDescription(1, 5).String,
"loss_correction_fec_threshold": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Loss correction FEC threshold").String,
Optional: true,
Validators: []validator.Int64{
int64validator.Between(1, 5),
},
},
"nat_pool": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("NAT pool").AddStringEnumDescription("pool").String,
Expand Down

0 comments on commit d126c6a

Please sign in to comment.