Skip to content

Commit 85436fb

Browse files
committed
fix docs
1 parent 4c20457 commit 85436fb

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

docs/resources/route.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ Route for Pomerium.
4141
- `jwt_issuer_format` (String) Format for JWT issuer strings. Use 'IssuerHostOnly' for hostname without scheme or trailing slash, or 'IssuerURI' for complete URI including scheme and trailing slash.
4242
- `kubernetes_service_account_token` (String) Kubernetes service account token.
4343
- `kubernetes_service_account_token_file` (String) Path to the Kubernetes service account token file.
44-
- `load_balancing_policy` (String) Load balancing policy.
44+
- `load_balancing_policy` (String) The following values are valid for the Load Balancing Policy field:
45+
46+
- `round_robin`
47+
- `maglev`
48+
- `random`
49+
- `ring_hash`
50+
- `least_request`
4551
- `logo_url` (String) URL to the logo image.
4652
- `pass_identity_headers` (Boolean) If applied, passes X-Pomerium-Jwt-Assertion header and JWT Claims Headers to the upstream application.
4753
- `path` (String) Matches incoming requests with a path that is an exact match for the specified path.

internal/provider/enum_optional.go

+15
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ func GetValidEnumValuesCanonical[T protoreflect.Enum](prefix string) []string {
3030
return values
3131
}
3232

33+
// GetValidEnumValuesCanonicalMarkdown returns a markdown string of valid enum values for a given protobuf enum type
34+
func GetValidEnumValuesCanonicalMarkdown[T protoreflect.Enum](name, prefix string) string {
35+
vals := GetValidEnumValuesCanonical[T](prefix)
36+
var sb strings.Builder
37+
sb.WriteString("The following values are valid for the ")
38+
sb.WriteString(name)
39+
sb.WriteString(" field:\n\n")
40+
for _, v := range vals {
41+
sb.WriteString("- `")
42+
sb.WriteString(v)
43+
sb.WriteString("`\n")
44+
}
45+
return sb.String()
46+
}
47+
3348
// EnumValueToPBWithDefault converts a string to a protobuf enum value.
3449
func OptionalEnumValueToPB[T interface {
3550
~int32

internal/provider/route.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ func (r *RouteResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
211211
},
212212
},
213213
"load_balancing_policy": schema.StringAttribute{
214-
Description: "Load balancing policy.",
215-
Optional: true,
214+
Description: "Load balancing policy.",
215+
MarkdownDescription: GetValidEnumValuesCanonicalMarkdown[pb.LoadBalancingPolicy]("Load Balancing Policy", "LOAD_BALANCING_POLICY"),
216+
Optional: true,
216217
Validators: []validator.String{
217218
stringvalidator.OneOf(GetValidEnumValuesCanonical[pb.LoadBalancingPolicy]("LOAD_BALANCING_POLICY")...),
218219
},

0 commit comments

Comments
 (0)