Repository: cloudflare/cloudflare-go
Pull request #1970 (2024-05-07 05:05:42)

feat(api): update via SDK Studio


Patch:
diff --git a/api.md b/api.md
index cac074f9b..64d993cf0 100644
--- a/api.md
+++ b/api.md
@@ -4727,7 +4727,7 @@ Params Types:
 
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AllowedHeadersParam">AllowedHeadersParam</a>
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AllowedIdPsParam">AllowedIdPsParam</a>
-- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AllowedMethodsParam">AllowedMethodsParam</a>
+- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AllowedMethods">AllowedMethods</a>
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AllowedOriginsParam">AllowedOriginsParam</a>
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AppIDUnionParam">AppIDUnionParam</a>
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ApplicationUnionParam">ApplicationUnionParam</a>
diff --git a/zero_trust/accessapplication.go b/zero_trust/accessapplication.go
index ea683a2a1..44e06ea7e 100644
--- a/zero_trust/accessapplication.go
+++ b/zero_trust/accessapplication.go
@@ -192,9 +192,27 @@ type AllowedIdPs = string
 
 type AllowedIdPsParam = string
 
-type AllowedMethods []AllowedMethodsItemItem
+type AllowedMethods string
 
-type AllowedMethodsParam []AllowedMethodsItemItem
+const (
+	AllowedMethodsGet     AllowedMethods = "GET"
+	AllowedMethodsPost    AllowedMethods = "POST"
+	AllowedMethodsHead    AllowedMethods = "HEAD"
+	AllowedMethodsPut     AllowedMethods = "PUT"
+	AllowedMethodsDelete  AllowedMethods = "DELETE"
+	AllowedMethodsConnect AllowedMethods = "CONNECT"
+	AllowedMethodsOptions AllowedMethods = "OPTIONS"
+	AllowedMethodsTrace   AllowedMethods = "TRACE"
+	AllowedMethodsPatch   AllowedMethods = "PATCH"
+)
+
+func (r AllowedMethods) IsKnown() bool {
+	switch r {
+	case AllowedMethodsGet, AllowedMethodsPost, AllowedMethodsHead, AllowedMethodsPut, AllowedMethodsDelete, AllowedMethodsConnect, AllowedMethodsOptions, AllowedMethodsTrace, AllowedMethodsPatch:
+		return true
+	}
+	return false
+}
 
 type AllowedOrigins = string
 
@@ -1868,7 +1886,7 @@ type CORSHeaders struct {
 	// Allowed HTTP request headers.
 	AllowedHeaders []AllowedHeaders `json:"allowed_headers"`
 	// Allowed HTTP request methods.
-	AllowedMethods AllowedMethods `json:"allowed_methods"`
+	AllowedMethods []AllowedMethods `json:"allowed_methods"`
 	// Allowed origins.
 	AllowedOrigins []AllowedOrigins `json:"allowed_origins"`
 	// The maximum number of seconds the results of a preflight request can be cached.
@@ -1911,7 +1929,7 @@ type CORSHeadersParam struct {
 	// Allowed HTTP request headers.
 	AllowedHeaders param.Field[[]AllowedHeadersParam] `json:"allowed_headers"`
 	// Allowed HTTP request methods.
-	AllowedMethods param.Field[AllowedMethodsParam] `json:"allowed_methods"`
+	AllowedMethods param.Field[[]AllowedMethods] `json:"allowed_methods"`
 	// Allowed origins.
 	AllowedOrigins param.Field[[]AllowedOriginsParam] `json:"allowed_origins"`
 	// The maximum number of seconds the results of a preflight request can be cached.


Test patch:
diff --git a/zero_trust/accessapplication_test.go b/zero_trust/accessapplication_test.go
index 4adba814d..625696239 100644
--- a/zero_trust/accessapplication_test.go
+++ b/zero_trust/accessapplication_test.go
@@ -41,7 +41,7 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) {
 				AllowAllOrigins:  cloudflare.F(true),
 				AllowCredentials: cloudflare.F(true),
 				AllowedHeaders:   cloudflare.F([]zero_trust.AllowedHeadersParam{"string", "string", "string"}),
-				AllowedMethods:   cloudflare.F([]zero_trust.AllowedMethodsItemItem{zero_trust.AllowedMethodsItemItemGet}),
+				AllowedMethods:   cloudflare.F([]zero_trust.AllowedMethods{zero_trust.AllowedMethodsGet}),
 				AllowedOrigins:   cloudflare.F([]zero_trust.AllowedOriginsParam{"https://example.com"}),
 				MaxAge:           cloudflare.F(-1.000000),
 			}),
@@ -105,7 +105,7 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) {
 					AllowAllOrigins:  cloudflare.F(true),
 					AllowCredentials: cloudflare.F(true),
 					AllowedHeaders:   cloudflare.F([]zero_trust.AllowedHeadersParam{"string", "string", "string"}),
-					AllowedMethods:   cloudflare.F([]zero_trust.AllowedMethodsItemItem{zero_trust.AllowedMethodsItemItemGet}),
+					AllowedMethods:   cloudflare.F([]zero_trust.AllowedMethods{zero_trust.AllowedMethodsGet}),
 					AllowedOrigins:   cloudflare.F([]zero_trust.AllowedOriginsParam{"https://example.com"}),
 					MaxAge:           cloudflare.F(-1.000000),
 				}),