@@ -3,6 +3,7 @@ package provider
3
3
import (
4
4
"context"
5
5
6
+ "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes"
6
7
"github.com/hashicorp/terraform-plugin-framework/attr"
7
8
"github.com/hashicorp/terraform-plugin-framework/diag"
8
9
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -11,41 +12,41 @@ import (
11
12
12
13
// RouteModel represents the shared model for route resources and data sources
13
14
type RouteModel struct {
14
- ID types.String `tfsdk:"id"`
15
- Name types.String `tfsdk:"name"`
16
- From types.String `tfsdk:"from"`
17
- To types.List `tfsdk:"to"`
18
- NamespaceID types.String `tfsdk:"namespace_id"`
19
- Policies types.List `tfsdk:"policies"`
20
- StatName types.String `tfsdk:"stat_name"`
21
- Prefix types.String `tfsdk:"prefix"`
22
- Path types.String `tfsdk:"path"`
23
- Regex types.String `tfsdk:"regex"`
24
- PrefixRewrite types.String `tfsdk:"prefix_rewrite"`
25
- RegexRewritePattern types.String `tfsdk:"regex_rewrite_pattern"`
26
- RegexRewriteSubstitution types.String `tfsdk:"regex_rewrite_substitution"`
27
- HostRewrite types.String `tfsdk:"host_rewrite"`
28
- HostRewriteHeader types.String `tfsdk:"host_rewrite_header"`
29
- HostPathRegexRewritePattern types.String `tfsdk:"host_path_regex_rewrite_pattern"`
30
- HostPathRegexRewriteSubstitution types.String `tfsdk:"host_path_regex_rewrite_substitution"`
31
- RegexPriorityOrder types.Int64 `tfsdk:"regex_priority_order"`
32
- Timeout types. String `tfsdk:"timeout"`
33
- IdleTimeout types. String `tfsdk:"idle_timeout"`
34
- AllowWebsockets types.Bool `tfsdk:"allow_websockets"`
35
- AllowSPDY types.Bool `tfsdk:"allow_spdy"`
36
- TLSSkipVerify types.Bool `tfsdk:"tls_skip_verify"`
37
- TLSUpstreamServerName types.String `tfsdk:"tls_upstream_server_name"`
38
- TLSDownstreamServerName types.String `tfsdk:"tls_downstream_server_name"`
39
- TLSUpstreamAllowRenegotiation types.Bool `tfsdk:"tls_upstream_allow_renegotiation"`
40
- SetRequestHeaders types.Map `tfsdk:"set_request_headers"`
41
- RemoveRequestHeaders types.List `tfsdk:"remove_request_headers"`
42
- SetResponseHeaders types.Map `tfsdk:"set_response_headers"`
43
- PreserveHostHeader types.Bool `tfsdk:"preserve_host_header"`
44
- PassIdentityHeaders types.Bool `tfsdk:"pass_identity_headers"`
45
- KubernetesServiceAccountToken types.String `tfsdk:"kubernetes_service_account_token"`
46
- IDPClientID types.String `tfsdk:"idp_client_id"`
47
- IDPClientSecret types.String `tfsdk:"idp_client_secret"`
48
- ShowErrorDetails types.Bool `tfsdk:"show_error_details"`
15
+ ID types.String `tfsdk:"id"`
16
+ Name types.String `tfsdk:"name"`
17
+ From types.String `tfsdk:"from"`
18
+ To types.List `tfsdk:"to"`
19
+ NamespaceID types.String `tfsdk:"namespace_id"`
20
+ Policies types.List `tfsdk:"policies"`
21
+ StatName types.String `tfsdk:"stat_name"`
22
+ Prefix types.String `tfsdk:"prefix"`
23
+ Path types.String `tfsdk:"path"`
24
+ Regex types.String `tfsdk:"regex"`
25
+ PrefixRewrite types.String `tfsdk:"prefix_rewrite"`
26
+ RegexRewritePattern types.String `tfsdk:"regex_rewrite_pattern"`
27
+ RegexRewriteSubstitution types.String `tfsdk:"regex_rewrite_substitution"`
28
+ HostRewrite types.String `tfsdk:"host_rewrite"`
29
+ HostRewriteHeader types.String `tfsdk:"host_rewrite_header"`
30
+ HostPathRegexRewritePattern types.String `tfsdk:"host_path_regex_rewrite_pattern"`
31
+ HostPathRegexRewriteSubstitution types.String `tfsdk:"host_path_regex_rewrite_substitution"`
32
+ RegexPriorityOrder types.Int64 `tfsdk:"regex_priority_order"`
33
+ Timeout timetypes. GoDuration `tfsdk:"timeout"`
34
+ IdleTimeout timetypes. GoDuration `tfsdk:"idle_timeout"`
35
+ AllowWebsockets types.Bool `tfsdk:"allow_websockets"`
36
+ AllowSPDY types.Bool `tfsdk:"allow_spdy"`
37
+ TLSSkipVerify types.Bool `tfsdk:"tls_skip_verify"`
38
+ TLSUpstreamServerName types.String `tfsdk:"tls_upstream_server_name"`
39
+ TLSDownstreamServerName types.String `tfsdk:"tls_downstream_server_name"`
40
+ TLSUpstreamAllowRenegotiation types.Bool `tfsdk:"tls_upstream_allow_renegotiation"`
41
+ SetRequestHeaders types.Map `tfsdk:"set_request_headers"`
42
+ RemoveRequestHeaders types.List `tfsdk:"remove_request_headers"`
43
+ SetResponseHeaders types.Map `tfsdk:"set_response_headers"`
44
+ PreserveHostHeader types.Bool `tfsdk:"preserve_host_header"`
45
+ PassIdentityHeaders types.Bool `tfsdk:"pass_identity_headers"`
46
+ KubernetesServiceAccountToken types.String `tfsdk:"kubernetes_service_account_token"`
47
+ IDPClientID types.String `tfsdk:"idp_client_id"`
48
+ IDPClientSecret types.String `tfsdk:"idp_client_secret"`
49
+ ShowErrorDetails types.Bool `tfsdk:"show_error_details"`
49
50
}
50
51
51
52
func ConvertRouteToPB (
@@ -71,8 +72,8 @@ func ConvertRouteToPB(
71
72
pbRoute .HostPathRegexRewritePattern = src .HostPathRegexRewritePattern .ValueStringPointer ()
72
73
pbRoute .HostPathRegexRewriteSubstitution = src .HostPathRegexRewriteSubstitution .ValueStringPointer ()
73
74
pbRoute .RegexPriorityOrder = src .RegexPriorityOrder .ValueInt64Pointer ()
74
- ToDuration (& pbRoute .Timeout , src .Timeout , "timeout" , & diagnostics )
75
- ToDuration (& pbRoute .IdleTimeout , src .IdleTimeout , "idle_timeout" , & diagnostics )
75
+ ToDuration (& pbRoute .Timeout , src .Timeout , & diagnostics )
76
+ ToDuration (& pbRoute .IdleTimeout , src .IdleTimeout , & diagnostics )
76
77
pbRoute .AllowWebsockets = src .AllowWebsockets .ValueBoolPointer ()
77
78
pbRoute .AllowSpdy = src .AllowSPDY .ValueBoolPointer ()
78
79
pbRoute .TlsSkipVerify = src .TLSSkipVerify .ValueBoolPointer ()
@@ -134,8 +135,8 @@ func ConvertRouteFromPB(
134
135
dst .HostPathRegexRewritePattern = types .StringPointerValue (src .HostPathRegexRewritePattern )
135
136
dst .HostPathRegexRewriteSubstitution = types .StringPointerValue (src .HostPathRegexRewriteSubstitution )
136
137
dst .RegexPriorityOrder = types .Int64PointerValue (src .RegexPriorityOrder )
137
- dst .Timeout = types . StringValue (src .Timeout . String () )
138
- dst .IdleTimeout = types . StringValue (src .IdleTimeout . String () )
138
+ dst .Timeout = FromDuration (src .Timeout )
139
+ dst .IdleTimeout = FromDuration (src .IdleTimeout )
139
140
dst .AllowWebsockets = types .BoolPointerValue (src .AllowWebsockets )
140
141
dst .AllowSPDY = types .BoolPointerValue (src .AllowSpdy )
141
142
dst .TLSSkipVerify = types .BoolPointerValue (src .TlsSkipVerify )
0 commit comments