From c4160d3e54622f5917bff90121b49a5e74be7814 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 7 May 2024 05:05:43 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#1970)
---
api.md | 2 +-
zero_trust/accessapplication.go | 26 ++++++++++++++++++++++----
zero_trust/accessapplication_test.go | 4 ++--
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/api.md b/api.md
index cac074f9b6e..64d993cf0c3 100644
--- a/api.md
+++ b/api.md
@@ -4727,7 +4727,7 @@ Params Types:
- zero_trust.AllowedHeadersParam
- zero_trust.AllowedIdPsParam
-- zero_trust.AllowedMethodsParam
+- zero_trust.AllowedMethods
- zero_trust.AllowedOriginsParam
- zero_trust.AppIDUnionParam
- zero_trust.ApplicationUnionParam
diff --git a/zero_trust/accessapplication.go b/zero_trust/accessapplication.go
index ea683a2a1a1..44e06ea7ed5 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.
diff --git a/zero_trust/accessapplication_test.go b/zero_trust/accessapplication_test.go
index 4adba814dfc..6256962391a 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),
}),