diff --git a/.stats.yml b/.stats.yml index c4813cf44d2..8d9571c000d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1297 +configured_endpoints: 1293 diff --git a/addressing/prefixbgpbinding.go b/addressing/prefixbgpbinding.go index 7802ca988b3..c4c7f559576 100644 --- a/addressing/prefixbgpbinding.go +++ b/addressing/prefixbgpbinding.go @@ -143,8 +143,6 @@ func (r serviceBindingJSON) RawJSON() string { func (r ServiceBinding) implementsWorkersBinding() {} -func (r ServiceBinding) implementsWorkersBindingItem() {} - // Status of a Service Binding's deployment to the Cloudflare network type ServiceBindingProvisioning struct { // When a binding has been deployed to a majority of Cloudflare datacenters, the @@ -186,42 +184,6 @@ func (r ServiceBindingProvisioningState) IsKnown() bool { return false } -type ServiceBindingParam struct { - // IP Prefix in Classless Inter-Domain Routing format. - CIDR param.Field[string] `json:"cidr"` - // Status of a Service Binding's deployment to the Cloudflare network - Provisioning param.Field[ServiceBindingProvisioningParam] `json:"provisioning"` - // Identifier - ServiceID param.Field[string] `json:"service_id"` - // Name of a service running on the Cloudflare network - ServiceName param.Field[string] `json:"service_name"` -} - -func (r ServiceBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -// Status of a Service Binding's deployment to the Cloudflare network -type ServiceBindingProvisioningParam struct { - // When a binding has been deployed to a majority of Cloudflare datacenters, the - // binding will become active and can be used with its associated service. - State param.Field[ServiceBindingProvisioningState] `json:"state"` -} - -func (r ServiceBindingProvisioningParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type PrefixBGPBindingNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` diff --git a/api.md b/api.md index 60f5b90d29e..76fa65cd9ce 100644 --- a/api.md +++ b/api.md @@ -2384,15 +2384,8 @@ Methods: Params Types: -- workers.D1BindingParam -- workers.DispatchNamespaceBindingParam -- workers.DurableObjectBindingParam -- workers.KVNamespaceBindingParam - workers.MigrationStepParam -- workers.MTLSCERTBindingParam - workers.PlacementConfigurationParam -- workers.R2BindingParam -- workers.ServiceBindingParam - workers.SingleStepMigrationParam - workers.SteppedMigrationParam @@ -2403,13 +2396,9 @@ Response Types: - workers.DispatchNamespaceBinding - workers.DurableObjectBinding - workers.KVNamespaceBinding -- workers.MigrationStep - workers.MTLSCERTBinding -- workers.PlacementConfiguration - workers.R2Binding - workers.ServiceBinding -- workers.SingleStepMigration -- workers.SteppedMigration ## AI @@ -2498,12 +2487,7 @@ Methods: Methods: - client.Workers.Scripts.Content.Update(ctx context.Context, scriptName string, params workers.ScriptContentUpdateParams) (workers.Script, error) - -### ContentV2 - -Methods: - -- client.Workers.Scripts.ContentV2.Get(ctx context.Context, scriptName string, query workers.ScriptContentV2GetParams) (http.Response, error) +- client.Workers.Scripts.Content.Get(ctx context.Context, scriptName string, query workers.ScriptContentGetParams) (http.Response, error) ### Settings @@ -2543,27 +2527,6 @@ Methods: - client.Workers.Scripts.Versions.List(ctx context.Context, scriptName string, query workers.ScriptVersionListParams) (workers.ScriptVersionListResponse, error) - client.Workers.Scripts.Versions.Get(ctx context.Context, scriptName string, versionID string, query workers.ScriptVersionGetParams) (workers.ScriptVersionGetResponse, error) -#### Settings - -Params Types: - -- workers.BindingItemUnionParam -- workers.CompatibilityFlagsItemParam -- workers.SettingsItemParam -- workers.TagsItemParam - -Response Types: - -- workers.BindingItem -- workers.CompatibilityFlagsItem -- workers.SettingsItem -- workers.TagsItem - -Methods: - -- client.Workers.Scripts.Versions.Settings.Edit(ctx context.Context, scriptName string, params workers.ScriptVersionSettingEditParams) (workers.SettingsItem, error) -- client.Workers.Scripts.Versions.Settings.Get(ctx context.Context, scriptName string, query workers.ScriptVersionSettingGetParams) (workers.SettingsItem, error) - ## Filters Response Types: @@ -2605,28 +2568,6 @@ Methods: - client.Workers.AccountSettings.Update(ctx context.Context, params workers.AccountSettingUpdateParams) (workers.AccountSettingUpdateResponse, error) - client.Workers.AccountSettings.Get(ctx context.Context, query workers.AccountSettingGetParams) (workers.AccountSettingGetResponse, error) -## Deployments - -### ByScripts - -Response Types: - -- workers.DeploymentByScriptGetResponse - -Methods: - -- client.Workers.Deployments.ByScripts.Get(ctx context.Context, scriptID string, query workers.DeploymentByScriptGetParams) (workers.DeploymentByScriptGetResponse, error) - -#### Details - -Response Types: - -- workers.DeploymentByScriptDetailGetResponse - -Methods: - -- client.Workers.Deployments.ByScripts.Details.Get(ctx context.Context, scriptID string, deploymentID string, query workers.DeploymentByScriptDetailGetParams) (workers.DeploymentByScriptDetailGetResponse, error) - ## Domains Response Types: @@ -3110,10 +3051,6 @@ Methods: #### Bindings -Params Types: - -- addressing.ServiceBindingParam - Response Types: - addressing.ServiceBinding diff --git a/workers/deployment.go b/workers/deployment.go deleted file mode 100644 index ef8bd4fb215..00000000000 --- a/workers/deployment.go +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers - -import ( - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// DeploymentService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewDeploymentService] method instead. -type DeploymentService struct { - Options []option.RequestOption - ByScripts *DeploymentByScriptService -} - -// NewDeploymentService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewDeploymentService(opts ...option.RequestOption) (r *DeploymentService) { - r = &DeploymentService{} - r.Options = opts - r.ByScripts = NewDeploymentByScriptService(opts...) - return -} diff --git a/workers/deploymentbyscript.go b/workers/deploymentbyscript.go deleted file mode 100644 index 2a72697940e..00000000000 --- a/workers/deploymentbyscript.go +++ /dev/null @@ -1,119 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// DeploymentByScriptService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewDeploymentByScriptService] method -// instead. -type DeploymentByScriptService struct { - Options []option.RequestOption - Details *DeploymentByScriptDetailService -} - -// NewDeploymentByScriptService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewDeploymentByScriptService(opts ...option.RequestOption) (r *DeploymentByScriptService) { - r = &DeploymentByScriptService{} - r.Options = opts - r.Details = NewDeploymentByScriptDetailService(opts...) - return -} - -// List Deployments -func (r *DeploymentByScriptService) Get(ctx context.Context, scriptID string, query DeploymentByScriptGetParams, opts ...option.RequestOption) (res *DeploymentByScriptGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env DeploymentByScriptGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s", query.AccountID, scriptID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type DeploymentByScriptGetResponse struct { - Items []interface{} `json:"items"` - Latest interface{} `json:"latest"` - JSON deploymentByScriptGetResponseJSON `json:"-"` -} - -// deploymentByScriptGetResponseJSON contains the JSON metadata for the struct -// [DeploymentByScriptGetResponse] -type deploymentByScriptGetResponseJSON struct { - Items apijson.Field - Latest apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DeploymentByScriptGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r deploymentByScriptGetResponseJSON) RawJSON() string { - return r.raw -} - -type DeploymentByScriptGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type DeploymentByScriptGetResponseEnvelope struct { - Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"` - Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"` - Result DeploymentByScriptGetResponse `json:"result,required"` - // Whether the API call was successful - Success DeploymentByScriptGetResponseEnvelopeSuccess `json:"success,required"` - JSON deploymentByScriptGetResponseEnvelopeJSON `json:"-"` -} - -// deploymentByScriptGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [DeploymentByScriptGetResponseEnvelope] -type deploymentByScriptGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DeploymentByScriptGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r deploymentByScriptGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type DeploymentByScriptGetResponseEnvelopeSuccess bool - -const ( - DeploymentByScriptGetResponseEnvelopeSuccessTrue DeploymentByScriptGetResponseEnvelopeSuccess = true -) - -func (r DeploymentByScriptGetResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case DeploymentByScriptGetResponseEnvelopeSuccessTrue: - return true - } - return false -} diff --git a/workers/deploymentbyscript_test.go b/workers/deploymentbyscript_test.go deleted file mode 100644 index 7615d9f5744..00000000000 --- a/workers/deploymentbyscript_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/workers" -) - -func TestDeploymentByScriptGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Workers.Deployments.ByScripts.Get( - context.TODO(), - "8ee82b3a2c0f42928b8f14dae4a97121", - workers.DeploymentByScriptGetParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/workers/deploymentbyscriptdetail.go b/workers/deploymentbyscriptdetail.go deleted file mode 100644 index 3fbb277ac6e..00000000000 --- a/workers/deploymentbyscriptdetail.go +++ /dev/null @@ -1,121 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// DeploymentByScriptDetailService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewDeploymentByScriptDetailService] method instead. -type DeploymentByScriptDetailService struct { - Options []option.RequestOption -} - -// NewDeploymentByScriptDetailService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewDeploymentByScriptDetailService(opts ...option.RequestOption) (r *DeploymentByScriptDetailService) { - r = &DeploymentByScriptDetailService{} - r.Options = opts - return -} - -// Get Deployment Detail -func (r *DeploymentByScriptDetailService) Get(ctx context.Context, scriptID string, deploymentID string, query DeploymentByScriptDetailGetParams, opts ...option.RequestOption) (res *DeploymentByScriptDetailGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env DeploymentByScriptDetailGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s/detail/%s", query.AccountID, scriptID, deploymentID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type DeploymentByScriptDetailGetResponse struct { - ID string `json:"id"` - Metadata interface{} `json:"metadata"` - Number float64 `json:"number"` - Resources interface{} `json:"resources"` - JSON deploymentByScriptDetailGetResponseJSON `json:"-"` -} - -// deploymentByScriptDetailGetResponseJSON contains the JSON metadata for the -// struct [DeploymentByScriptDetailGetResponse] -type deploymentByScriptDetailGetResponseJSON struct { - ID apijson.Field - Metadata apijson.Field - Number apijson.Field - Resources apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DeploymentByScriptDetailGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r deploymentByScriptDetailGetResponseJSON) RawJSON() string { - return r.raw -} - -type DeploymentByScriptDetailGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type DeploymentByScriptDetailGetResponseEnvelope struct { - Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"` - Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"` - Result DeploymentByScriptDetailGetResponse `json:"result,required"` - // Whether the API call was successful - Success DeploymentByScriptDetailGetResponseEnvelopeSuccess `json:"success,required"` - JSON deploymentByScriptDetailGetResponseEnvelopeJSON `json:"-"` -} - -// deploymentByScriptDetailGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [DeploymentByScriptDetailGetResponseEnvelope] -type deploymentByScriptDetailGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DeploymentByScriptDetailGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r deploymentByScriptDetailGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type DeploymentByScriptDetailGetResponseEnvelopeSuccess bool - -const ( - DeploymentByScriptDetailGetResponseEnvelopeSuccessTrue DeploymentByScriptDetailGetResponseEnvelopeSuccess = true -) - -func (r DeploymentByScriptDetailGetResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case DeploymentByScriptDetailGetResponseEnvelopeSuccessTrue: - return true - } - return false -} diff --git a/workers/deploymentbyscriptdetail_test.go b/workers/deploymentbyscriptdetail_test.go deleted file mode 100644 index 412b34c9c6e..00000000000 --- a/workers/deploymentbyscriptdetail_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/workers" -) - -func TestDeploymentByScriptDetailGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Workers.Deployments.ByScripts.Details.Get( - context.TODO(), - "8ee82b3a2c0f42928b8f14dae4a97121", - "bcf48806-b317-4351-9ee7-36e7d557d4de", - workers.DeploymentByScriptDetailGetParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/workers/script.go b/workers/script.go index 9d9163dfbbe..cdfa25dc7a3 100644 --- a/workers/script.go +++ b/workers/script.go @@ -33,7 +33,6 @@ type ScriptService struct { Tail *ScriptTailService UsageModel *ScriptUsageModelService Content *ScriptContentService - ContentV2 *ScriptContentV2Service Settings *ScriptSettingService Deployments *ScriptDeploymentService Versions *ScriptVersionService @@ -50,7 +49,6 @@ func NewScriptService(opts ...option.RequestOption) (r *ScriptService) { r.Tail = NewScriptTailService(opts...) r.UsageModel = NewScriptUsageModelService(opts...) r.Content = NewScriptContentService(opts...) - r.ContentV2 = NewScriptContentV2Service(opts...) r.Settings = NewScriptSettingService(opts...) r.Deployments = NewScriptDeploymentService(opts...) r.Versions = NewScriptVersionService(opts...) diff --git a/workers/scriptcontent.go b/workers/scriptcontent.go index b92b479c100..71176c51bf4 100644 --- a/workers/scriptcontent.go +++ b/workers/scriptcontent.go @@ -49,6 +49,15 @@ func (r *ScriptContentService) Update(ctx context.Context, scriptName string, pa return } +// Fetch script content only +func (r *ScriptContentService) Get(ctx context.Context, scriptName string, query ScriptContentGetParams, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "string")}, opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/content/v2", query.AccountID, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + type ScriptContentUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` @@ -121,3 +130,8 @@ func (r ScriptContentUpdateResponseEnvelopeSuccess) IsKnown() bool { } return false } + +type ScriptContentGetParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} diff --git a/workers/scriptcontent_test.go b/workers/scriptcontent_test.go index aeb41c7e588..a223f19c24c 100644 --- a/workers/scriptcontent_test.go +++ b/workers/scriptcontent_test.go @@ -7,6 +7,8 @@ import ( "context" "errors" "io" + "net/http" + "net/http/httptest" "os" "testing" @@ -53,3 +55,45 @@ func TestScriptContentUpdateWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestScriptContentGet(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + w.Write([]byte("abc")) + })) + defer server.Close() + baseURL := server.URL + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + resp, err := client.Workers.Scripts.Content.Get( + context.TODO(), + "this-is_my_script-01", + workers.ScriptContentGetParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } + defer resp.Body.Close() + + b, err := io.ReadAll(resp.Body) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } + if !bytes.Equal(b, []byte("abc")) { + t.Fatalf("return value not %s: %s", "abc", b) + } +} diff --git a/workers/scriptcontentv2.go b/workers/scriptcontentv2.go deleted file mode 100644 index 15729bd9291..00000000000 --- a/workers/scriptcontentv2.go +++ /dev/null @@ -1,45 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// ScriptContentV2Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewScriptContentV2Service] method -// instead. -type ScriptContentV2Service struct { - Options []option.RequestOption -} - -// NewScriptContentV2Service generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewScriptContentV2Service(opts ...option.RequestOption) (r *ScriptContentV2Service) { - r = &ScriptContentV2Service{} - r.Options = opts - return -} - -// Fetch script content only -func (r *ScriptContentV2Service) Get(ctx context.Context, scriptName string, query ScriptContentV2GetParams, opts ...option.RequestOption) (res *http.Response, err error) { - opts = append(r.Options[:], opts...) - opts = append([]option.RequestOption{option.WithHeader("Accept", "string")}, opts...) - path := fmt.Sprintf("accounts/%s/workers/scripts/%s/content/v2", query.AccountID, scriptName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) - return -} - -type ScriptContentV2GetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} diff --git a/workers/scriptcontentv2_test.go b/workers/scriptcontentv2_test.go deleted file mode 100644 index 284d164689d..00000000000 --- a/workers/scriptcontentv2_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers_test - -import ( - "bytes" - "context" - "errors" - "io" - "net/http" - "net/http/httptest" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/workers" -) - -func TestScriptContentV2Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Write([]byte("abc")) - })) - defer server.Close() - baseURL := server.URL - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - resp, err := client.Workers.Scripts.ContentV2.Get( - context.TODO(), - "this-is_my_script-01", - workers.ScriptContentV2GetParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } - defer resp.Body.Close() - - b, err := io.ReadAll(resp.Body) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } - if !bytes.Equal(b, []byte("abc")) { - t.Fatalf("return value not %s: %s", "abc", b) - } -} diff --git a/workers/scriptversion.go b/workers/scriptversion.go index a63d69427cd..9f106aa7ef1 100644 --- a/workers/scriptversion.go +++ b/workers/scriptversion.go @@ -24,8 +24,7 @@ import ( // this service directly, and instead use the [NewScriptVersionService] method // instead. type ScriptVersionService struct { - Options []option.RequestOption - Settings *ScriptVersionSettingService + Options []option.RequestOption } // NewScriptVersionService generates a new service that applies the given options @@ -34,7 +33,6 @@ type ScriptVersionService struct { func NewScriptVersionService(opts ...option.RequestOption) (r *ScriptVersionService) { r = &ScriptVersionService{} r.Options = opts - r.Settings = NewScriptVersionSettingService(opts...) return } diff --git a/workers/scriptversionsetting.go b/workers/scriptversionsetting.go deleted file mode 100644 index 6577d6989ec..00000000000 --- a/workers/scriptversionsetting.go +++ /dev/null @@ -1,577 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers - -import ( - "context" - "fmt" - "net/http" - "reflect" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" -) - -// ScriptVersionSettingService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewScriptVersionSettingService] -// method instead. -type ScriptVersionSettingService struct { - Options []option.RequestOption -} - -// NewScriptVersionSettingService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewScriptVersionSettingService(opts ...option.RequestOption) (r *ScriptVersionSettingService) { - r = &ScriptVersionSettingService{} - r.Options = opts - return -} - -// Patch metadata or config, such as bindings or usage model -func (r *ScriptVersionSettingService) Edit(ctx context.Context, scriptName string, params ScriptVersionSettingEditParams, opts ...option.RequestOption) (res *SettingsItem, err error) { - opts = append(r.Options[:], opts...) - var env ScriptVersionSettingEditResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/scripts/%s/settings", params.AccountID, scriptName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Get metadata and config, such as bindings or usage model -func (r *ScriptVersionSettingService) Get(ctx context.Context, scriptName string, query ScriptVersionSettingGetParams, opts ...option.RequestOption) (res *SettingsItem, err error) { - opts = append(r.Options[:], opts...) - var env ScriptVersionSettingGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/scripts/%s/settings", query.AccountID, scriptName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// A binding to allow the Worker to communicate with resources -type BindingItem struct { - // A JavaScript variable name for the binding. - Name string `json:"name,required"` - // Namespace identifier tag. - NamespaceID string `json:"namespace_id"` - // The class of resource that the binding provides. - Type BindingItemType `json:"type,required"` - // Optional environment if the Worker utilizes one. - Environment string `json:"environment"` - // Name of Worker to bind to - Service string `json:"service"` - // The exported class name of the Durable Object - ClassName string `json:"class_name"` - // The script where the Durable Object is defined, if it is external to this Worker - ScriptName string `json:"script_name"` - // R2 bucket to bind to - BucketName string `json:"bucket_name"` - // Name of the Queue to bind to - QueueName string `json:"queue_name"` - // A JavaScript variable name for the binding. - Binding string `json:"binding"` - // ID of the D1 database to bind to - ID string `json:"id"` - // Namespace to bind to - Namespace string `json:"namespace"` - Outbound interface{} `json:"outbound,required"` - // ID of the certificate to bind to - CertificateID string `json:"certificate_id"` - Certificate interface{} `json:"certificate,required"` - JSON bindingItemJSON `json:"-"` - union BindingItemUnion -} - -// bindingItemJSON contains the JSON metadata for the struct [BindingItem] -type bindingItemJSON struct { - Name apijson.Field - NamespaceID apijson.Field - Type apijson.Field - Environment apijson.Field - Service apijson.Field - ClassName apijson.Field - ScriptName apijson.Field - BucketName apijson.Field - QueueName apijson.Field - Binding apijson.Field - ID apijson.Field - Namespace apijson.Field - Outbound apijson.Field - CertificateID apijson.Field - Certificate apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r bindingItemJSON) RawJSON() string { - return r.raw -} - -func (r *BindingItem) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r BindingItem) AsUnion() BindingItemUnion { - return r.union -} - -// A binding to allow the Worker to communicate with resources -// -// Union satisfied by [workers.KVNamespaceBinding], [workers.ServiceBinding], -// [workers.DurableObjectBinding], [workers.R2Binding], -// [workers.BindingItemWorkersQueueBinding], [workers.D1Binding], -// [workers.DispatchNamespaceBinding] or [workers.MTLSCERTBinding]. -type BindingItemUnion interface { - implementsWorkersBindingItem() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*BindingItemUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(KVNamespaceBinding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ServiceBinding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(DurableObjectBinding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(R2Binding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BindingItemWorkersQueueBinding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(D1Binding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(DispatchNamespaceBinding{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(MTLSCERTBinding{}), - }, - ) -} - -type BindingItemWorkersQueueBinding struct { - // A JavaScript variable name for the binding. - Name string `json:"name,required"` - // Name of the Queue to bind to - QueueName string `json:"queue_name,required"` - // The class of resource that the binding provides. - Type BindingItemWorkersQueueBindingType `json:"type,required"` - JSON bindingItemWorkersQueueBindingJSON `json:"-"` -} - -// bindingItemWorkersQueueBindingJSON contains the JSON metadata for the struct -// [BindingItemWorkersQueueBinding] -type bindingItemWorkersQueueBindingJSON struct { - Name apijson.Field - QueueName apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BindingItemWorkersQueueBinding) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r bindingItemWorkersQueueBindingJSON) RawJSON() string { - return r.raw -} - -func (r BindingItemWorkersQueueBinding) implementsWorkersBindingItem() {} - -// The class of resource that the binding provides. -type BindingItemWorkersQueueBindingType string - -const ( - BindingItemWorkersQueueBindingTypeQueue BindingItemWorkersQueueBindingType = "queue" -) - -func (r BindingItemWorkersQueueBindingType) IsKnown() bool { - switch r { - case BindingItemWorkersQueueBindingTypeQueue: - return true - } - return false -} - -// The class of resource that the binding provides. -type BindingItemType string - -const ( - BindingItemTypeKVNamespace BindingItemType = "kv_namespace" - BindingItemTypeService BindingItemType = "service" - BindingItemTypeDurableObjectNamespace BindingItemType = "durable_object_namespace" - BindingItemTypeR2Bucket BindingItemType = "r2_bucket" - BindingItemTypeQueue BindingItemType = "queue" - BindingItemTypeD1 BindingItemType = "d1" - BindingItemTypeDispatchNamespace BindingItemType = "dispatch_namespace" - BindingItemTypeMTLSCertificate BindingItemType = "mtls_certificate" -) - -func (r BindingItemType) IsKnown() bool { - switch r { - case BindingItemTypeKVNamespace, BindingItemTypeService, BindingItemTypeDurableObjectNamespace, BindingItemTypeR2Bucket, BindingItemTypeQueue, BindingItemTypeD1, BindingItemTypeDispatchNamespace, BindingItemTypeMTLSCertificate: - return true - } - return false -} - -// A binding to allow the Worker to communicate with resources -type BindingItemParam struct { - // The class of resource that the binding provides. - Type param.Field[BindingItemType] `json:"type,required"` - // Optional environment if the Worker utilizes one. - Environment param.Field[string] `json:"environment"` - // Name of Worker to bind to - Service param.Field[string] `json:"service"` - // The exported class name of the Durable Object - ClassName param.Field[string] `json:"class_name"` - // The script where the Durable Object is defined, if it is external to this Worker - ScriptName param.Field[string] `json:"script_name"` - // R2 bucket to bind to - BucketName param.Field[string] `json:"bucket_name"` - // Name of the Queue to bind to - QueueName param.Field[string] `json:"queue_name"` - // ID of the D1 database to bind to - ID param.Field[string] `json:"id"` - // Namespace to bind to - Namespace param.Field[string] `json:"namespace"` - Outbound param.Field[interface{}] `json:"outbound,required"` - // ID of the certificate to bind to - CertificateID param.Field[string] `json:"certificate_id"` - Certificate param.Field[interface{}] `json:"certificate,required"` -} - -func (r BindingItemParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r BindingItemParam) implementsWorkersBindingItemUnionParam() {} - -// A binding to allow the Worker to communicate with resources -// -// Satisfied by [workers.KVNamespaceBindingParam], [workers.ServiceBindingParam], -// [workers.DurableObjectBindingParam], [workers.R2BindingParam], -// [workers.BindingItemWorkersQueueBindingParam], [workers.D1BindingParam], -// [workers.DispatchNamespaceBindingParam], [workers.MTLSCERTBindingParam], -// [BindingItemParam]. -type BindingItemUnionParam interface { - implementsWorkersBindingItemUnionParam() -} - -type BindingItemWorkersQueueBindingParam struct { - // Name of the Queue to bind to - QueueName param.Field[string] `json:"queue_name,required"` - // The class of resource that the binding provides. - Type param.Field[BindingItemWorkersQueueBindingType] `json:"type,required"` -} - -func (r BindingItemWorkersQueueBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r BindingItemWorkersQueueBindingParam) implementsWorkersBindingItemUnionParam() {} - -type CompatibilityFlagsItem = string - -type CompatibilityFlagsItemParam = string - -type SettingsItem struct { - // List of bindings attached to this Worker - Bindings []BindingItem `json:"bindings"` - // Opt your Worker into changes after this date - CompatibilityDate string `json:"compatibility_date"` - // Opt your Worker into specific changes - CompatibilityFlags []CompatibilityFlagsItem `json:"compatibility_flags"` - // Whether Logpush is turned on for the Worker. - Logpush bool `json:"logpush"` - // Migrations to apply for Durable Objects associated with this Worker. - Migrations SettingsItemMigrations `json:"migrations"` - Placement PlacementConfiguration `json:"placement"` - // Tags to help you manage your Workers - Tags []TagsItem `json:"tags"` - // List of Workers that will consume logs from the attached Worker. - TailConsumers []ConsumerScriptItem `json:"tail_consumers"` - // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). - UsageModel string `json:"usage_model"` - JSON settingsItemJSON `json:"-"` -} - -// settingsItemJSON contains the JSON metadata for the struct [SettingsItem] -type settingsItemJSON struct { - Bindings apijson.Field - CompatibilityDate apijson.Field - CompatibilityFlags apijson.Field - Logpush apijson.Field - Migrations apijson.Field - Placement apijson.Field - Tags apijson.Field - TailConsumers apijson.Field - UsageModel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingsItem) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r settingsItemJSON) RawJSON() string { - return r.raw -} - -// Migrations to apply for Durable Objects associated with this Worker. -type SettingsItemMigrations struct { - // Tag to set as the latest migration tag. - NewTag string `json:"new_tag"` - // Tag used to verify against the latest migration tag for this Worker. If they - // don't match, the upload is rejected. - OldTag string `json:"old_tag"` - DeletedClasses interface{} `json:"deleted_classes,required"` - NewClasses interface{} `json:"new_classes,required"` - RenamedClasses interface{} `json:"renamed_classes,required"` - TransferredClasses interface{} `json:"transferred_classes,required"` - Steps interface{} `json:"steps,required"` - JSON settingsItemMigrationsJSON `json:"-"` - union SettingsItemMigrationsUnion -} - -// settingsItemMigrationsJSON contains the JSON metadata for the struct -// [SettingsItemMigrations] -type settingsItemMigrationsJSON struct { - NewTag apijson.Field - OldTag apijson.Field - DeletedClasses apijson.Field - NewClasses apijson.Field - RenamedClasses apijson.Field - TransferredClasses apijson.Field - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r settingsItemMigrationsJSON) RawJSON() string { - return r.raw -} - -func (r *SettingsItemMigrations) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r SettingsItemMigrations) AsUnion() SettingsItemMigrationsUnion { - return r.union -} - -// Migrations to apply for Durable Objects associated with this Worker. -// -// Union satisfied by [workers.SingleStepMigration] or [workers.SteppedMigration]. -type SettingsItemMigrationsUnion interface { - implementsWorkersSettingsItemMigrations() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*SettingsItemMigrationsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SingleStepMigration{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SteppedMigration{}), - }, - ) -} - -type SettingsItemParam struct { - // List of bindings attached to this Worker - Bindings param.Field[[]BindingItemUnionParam] `json:"bindings"` - // Opt your Worker into changes after this date - CompatibilityDate param.Field[string] `json:"compatibility_date"` - // Opt your Worker into specific changes - CompatibilityFlags param.Field[[]CompatibilityFlagsItemParam] `json:"compatibility_flags"` - // Whether Logpush is turned on for the Worker. - Logpush param.Field[bool] `json:"logpush"` - // Migrations to apply for Durable Objects associated with this Worker. - Migrations param.Field[SettingsItemMigrationsUnionParam] `json:"migrations"` - Placement param.Field[PlacementConfigurationParam] `json:"placement"` - // Tags to help you manage your Workers - Tags param.Field[[]TagsItemParam] `json:"tags"` - // List of Workers that will consume logs from the attached Worker. - TailConsumers param.Field[[]ConsumerScriptItemParam] `json:"tail_consumers"` - // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). - UsageModel param.Field[string] `json:"usage_model"` -} - -func (r SettingsItemParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Migrations to apply for Durable Objects associated with this Worker. -type SettingsItemMigrationsParam struct { - // Tag to set as the latest migration tag. - NewTag param.Field[string] `json:"new_tag"` - // Tag used to verify against the latest migration tag for this Worker. If they - // don't match, the upload is rejected. - OldTag param.Field[string] `json:"old_tag"` - DeletedClasses param.Field[interface{}] `json:"deleted_classes,required"` - NewClasses param.Field[interface{}] `json:"new_classes,required"` - RenamedClasses param.Field[interface{}] `json:"renamed_classes,required"` - TransferredClasses param.Field[interface{}] `json:"transferred_classes,required"` - Steps param.Field[interface{}] `json:"steps,required"` -} - -func (r SettingsItemMigrationsParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingsItemMigrationsParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -// Migrations to apply for Durable Objects associated with this Worker. -// -// Satisfied by [workers.SingleStepMigrationParam], -// [workers.SteppedMigrationParam], [SettingsItemMigrationsParam]. -type SettingsItemMigrationsUnionParam interface { - implementsWorkersSettingsItemMigrationsUnionParam() -} - -type TagsItem = string - -type TagsItemParam = string - -type ScriptVersionSettingEditParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Settings param.Field[SettingsItemParam] `json:"settings"` -} - -func (r ScriptVersionSettingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ScriptVersionSettingEditResponseEnvelope struct { - Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"` - Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"` - Result SettingsItem `json:"result,required"` - // Whether the API call was successful - Success ScriptVersionSettingEditResponseEnvelopeSuccess `json:"success,required"` - JSON scriptVersionSettingEditResponseEnvelopeJSON `json:"-"` -} - -// scriptVersionSettingEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [ScriptVersionSettingEditResponseEnvelope] -type scriptVersionSettingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ScriptVersionSettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r scriptVersionSettingEditResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type ScriptVersionSettingEditResponseEnvelopeSuccess bool - -const ( - ScriptVersionSettingEditResponseEnvelopeSuccessTrue ScriptVersionSettingEditResponseEnvelopeSuccess = true -) - -func (r ScriptVersionSettingEditResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case ScriptVersionSettingEditResponseEnvelopeSuccessTrue: - return true - } - return false -} - -type ScriptVersionSettingGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type ScriptVersionSettingGetResponseEnvelope struct { - Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"` - Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"` - Result SettingsItem `json:"result,required"` - // Whether the API call was successful - Success ScriptVersionSettingGetResponseEnvelopeSuccess `json:"success,required"` - JSON scriptVersionSettingGetResponseEnvelopeJSON `json:"-"` -} - -// scriptVersionSettingGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [ScriptVersionSettingGetResponseEnvelope] -type scriptVersionSettingGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ScriptVersionSettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r scriptVersionSettingGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type ScriptVersionSettingGetResponseEnvelopeSuccess bool - -const ( - ScriptVersionSettingGetResponseEnvelopeSuccessTrue ScriptVersionSettingGetResponseEnvelopeSuccess = true -) - -func (r ScriptVersionSettingGetResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case ScriptVersionSettingGetResponseEnvelopeSuccessTrue: - return true - } - return false -} diff --git a/workers/scriptversionsetting_test.go b/workers/scriptversionsetting_test.go deleted file mode 100644 index b18d34fec1d..00000000000 --- a/workers/scriptversionsetting_test.go +++ /dev/null @@ -1,134 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package workers_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/workers" -) - -func TestScriptVersionSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Workers.Scripts.Versions.Settings.Edit( - context.TODO(), - "this-is_my_script-01", - workers.ScriptVersionSettingEditParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Settings: cloudflare.F(workers.SettingsItemParam{ - Bindings: cloudflare.F([]workers.BindingItemUnionParam{workers.KVNamespaceBindingParam{ - Type: cloudflare.F(workers.KVNamespaceBindingTypeKVNamespace), - }, workers.KVNamespaceBindingParam{ - Type: cloudflare.F(workers.KVNamespaceBindingTypeKVNamespace), - }, workers.KVNamespaceBindingParam{ - Type: cloudflare.F(workers.KVNamespaceBindingTypeKVNamespace), - }}), - CompatibilityDate: cloudflare.F("2022-04-05"), - CompatibilityFlags: cloudflare.F([]workers.CompatibilityFlagsItemParam{"formdata_parser_supports_files", "formdata_parser_supports_files", "formdata_parser_supports_files"}), - Logpush: cloudflare.F(false), - Migrations: cloudflare.F[workers.SettingsItemMigrationsUnionParam](workers.SingleStepMigrationParam{ - NewTag: cloudflare.F("v2"), - OldTag: cloudflare.F("v1"), - DeletedClasses: cloudflare.F([]string{"string", "string", "string"}), - NewClasses: cloudflare.F([]string{"string", "string", "string"}), - RenamedClasses: cloudflare.F([]workers.SingleStepMigrationRenamedClassParam{{ - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }}), - TransferredClasses: cloudflare.F([]workers.SingleStepMigrationTransferredClassParam{{ - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), - }}), - }), - Placement: cloudflare.F(workers.PlacementConfigurationParam{ - Mode: cloudflare.F(workers.PlacementConfigurationModeSmart), - }), - Tags: cloudflare.F([]workers.TagsItemParam{"my-tag", "my-tag", "my-tag"}), - TailConsumers: cloudflare.F([]workers.ConsumerScriptItemParam{{ - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }}), - UsageModel: cloudflare.F("unbound"), - }), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestScriptVersionSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Workers.Scripts.Versions.Settings.Get( - context.TODO(), - "this-is_my_script-01", - workers.ScriptVersionSettingGetParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/workers/worker.go b/workers/worker.go index 3c0a400aefb..188d82eae2c 100644 --- a/workers/worker.go +++ b/workers/worker.go @@ -22,7 +22,6 @@ type WorkerService struct { Filters *FilterService Routes *RouteService AccountSettings *AccountSettingService - Deployments *DeploymentService Domains *DomainService Subdomains *SubdomainService Services *ServiceService @@ -39,7 +38,6 @@ func NewWorkerService(opts ...option.RequestOption) (r *WorkerService) { r.Filters = NewFilterService(opts...) r.Routes = NewRouteService(opts...) r.AccountSettings = NewAccountSettingService(opts...) - r.Deployments = NewDeploymentService(opts...) r.Domains = NewDomainService(opts...) r.Subdomains = NewSubdomainService(opts...) r.Services = NewServiceService(opts...) @@ -265,8 +263,6 @@ func (r d1BindingJSON) RawJSON() string { func (r D1Binding) implementsWorkersBinding() {} -func (r D1Binding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type D1BindingType string @@ -282,29 +278,6 @@ func (r D1BindingType) IsKnown() bool { return false } -type D1BindingParam struct { - // ID of the D1 database to bind to - ID param.Field[string] `json:"id,required"` - // The name of the D1 database associated with the 'id' provided. - Name param.Field[string] `json:"name,required"` - // The class of resource that the binding provides. - Type param.Field[D1BindingType] `json:"type,required"` -} - -func (r D1BindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r D1BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r D1BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r D1BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r D1BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r D1BindingParam) implementsWorkersBindingItemUnionParam() {} - type DispatchNamespaceBinding struct { // A JavaScript variable name for the binding. Name string `json:"name,required"` @@ -338,8 +311,6 @@ func (r dispatchNamespaceBindingJSON) RawJSON() string { func (r DispatchNamespaceBinding) implementsWorkersBinding() {} -func (r DispatchNamespaceBinding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type DispatchNamespaceBindingType string @@ -408,54 +379,6 @@ func (r dispatchNamespaceBindingOutboundWorkerJSON) RawJSON() string { return r.raw } -type DispatchNamespaceBindingParam struct { - // Namespace to bind to - Namespace param.Field[string] `json:"namespace,required"` - // The class of resource that the binding provides. - Type param.Field[DispatchNamespaceBindingType] `json:"type,required"` - // Outbound worker - Outbound param.Field[DispatchNamespaceBindingOutboundParam] `json:"outbound"` -} - -func (r DispatchNamespaceBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r DispatchNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DispatchNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DispatchNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DispatchNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DispatchNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -// Outbound worker -type DispatchNamespaceBindingOutboundParam struct { - // Pass information from the Dispatch Worker to the Outbound Worker through the - // parameters - Params param.Field[[]string] `json:"params"` - // Outbound worker - Worker param.Field[DispatchNamespaceBindingOutboundWorkerParam] `json:"worker"` -} - -func (r DispatchNamespaceBindingOutboundParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Outbound worker -type DispatchNamespaceBindingOutboundWorkerParam struct { - // Environment of the outbound worker - Environment param.Field[string] `json:"environment"` - // Name of the outbound worker - Service param.Field[string] `json:"service"` -} - -func (r DispatchNamespaceBindingOutboundWorkerParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type DurableObjectBinding struct { // The exported class name of the Durable Object ClassName string `json:"class_name,required"` @@ -495,8 +418,6 @@ func (r durableObjectBindingJSON) RawJSON() string { func (r DurableObjectBinding) implementsWorkersBinding() {} -func (r DurableObjectBinding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type DurableObjectBindingType string @@ -512,31 +433,6 @@ func (r DurableObjectBindingType) IsKnown() bool { return false } -type DurableObjectBindingParam struct { - // The exported class name of the Durable Object - ClassName param.Field[string] `json:"class_name,required"` - // The class of resource that the binding provides. - Type param.Field[DurableObjectBindingType] `json:"type,required"` - // The environment of the script_name to bind to - Environment param.Field[string] `json:"environment"` - // The script where the Durable Object is defined, if it is external to this Worker - ScriptName param.Field[string] `json:"script_name"` -} - -func (r DurableObjectBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r DurableObjectBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DurableObjectBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DurableObjectBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DurableObjectBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r DurableObjectBindingParam) implementsWorkersBindingItemUnionParam() {} - type KVNamespaceBinding struct { // A JavaScript variable name for the binding. Name string `json:"name,required"` @@ -567,8 +463,6 @@ func (r kvNamespaceBindingJSON) RawJSON() string { func (r KVNamespaceBinding) implementsWorkersBinding() {} -func (r KVNamespaceBinding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type KVNamespaceBindingType string @@ -584,104 +478,6 @@ func (r KVNamespaceBindingType) IsKnown() bool { return false } -type KVNamespaceBindingParam struct { - // The class of resource that the binding provides. - Type param.Field[KVNamespaceBindingType] `json:"type,required"` -} - -func (r KVNamespaceBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r KVNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r KVNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r KVNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r KVNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r KVNamespaceBindingParam) implementsWorkersBindingItemUnionParam() {} - -type MigrationStep struct { - // A list of classes to delete Durable Object namespaces from. - DeletedClasses []string `json:"deleted_classes"` - // A list of classes to create Durable Object namespaces from. - NewClasses []string `json:"new_classes"` - // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses []MigrationStepRenamedClass `json:"renamed_classes"` - // A list of transfers for Durable Object namespaces from a different Worker and - // class to a class defined in this Worker. - TransferredClasses []MigrationStepTransferredClass `json:"transferred_classes"` - JSON migrationStepJSON `json:"-"` -} - -// migrationStepJSON contains the JSON metadata for the struct [MigrationStep] -type migrationStepJSON struct { - DeletedClasses apijson.Field - NewClasses apijson.Field - RenamedClasses apijson.Field - TransferredClasses apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MigrationStep) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r migrationStepJSON) RawJSON() string { - return r.raw -} - -type MigrationStepRenamedClass struct { - From string `json:"from"` - To string `json:"to"` - JSON migrationStepRenamedClassJSON `json:"-"` -} - -// migrationStepRenamedClassJSON contains the JSON metadata for the struct -// [MigrationStepRenamedClass] -type migrationStepRenamedClassJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MigrationStepRenamedClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r migrationStepRenamedClassJSON) RawJSON() string { - return r.raw -} - -type MigrationStepTransferredClass struct { - From string `json:"from"` - FromScript string `json:"from_script"` - To string `json:"to"` - JSON migrationStepTransferredClassJSON `json:"-"` -} - -// migrationStepTransferredClassJSON contains the JSON metadata for the struct -// [MigrationStepTransferredClass] -type migrationStepTransferredClassJSON struct { - From apijson.Field - FromScript apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MigrationStepTransferredClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r migrationStepTransferredClassJSON) RawJSON() string { - return r.raw -} - type MigrationStepParam struct { // A list of classes to delete Durable Object namespaces from. DeletedClasses param.Field[[]string] `json:"deleted_classes"` @@ -748,8 +544,6 @@ func (r mtlscertBindingJSON) RawJSON() string { func (r MTLSCERTBinding) implementsWorkersBinding() {} -func (r MTLSCERTBinding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type MTLSCERTBindingType string @@ -765,50 +559,15 @@ func (r MTLSCERTBindingType) IsKnown() bool { return false } -type MTLSCERTBindingParam struct { - Certificate param.Field[interface{}] `json:"certificate,required"` - // The class of resource that the binding provides. - Type param.Field[MTLSCERTBindingType] `json:"type,required"` - // ID of the certificate to bind to - CertificateID param.Field[string] `json:"certificate_id"` -} - -func (r MTLSCERTBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r MTLSCERTBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r MTLSCERTBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r MTLSCERTBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r MTLSCERTBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r MTLSCERTBindingParam) implementsWorkersBindingItemUnionParam() {} - -type PlacementConfiguration struct { +type PlacementConfigurationParam struct { // Enables // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). // Only `"smart"` is currently supported - Mode PlacementConfigurationMode `json:"mode"` - JSON placementConfigurationJSON `json:"-"` -} - -// placementConfigurationJSON contains the JSON metadata for the struct -// [PlacementConfiguration] -type placementConfigurationJSON struct { - Mode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PlacementConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + Mode param.Field[PlacementConfigurationMode] `json:"mode"` } -func (r placementConfigurationJSON) RawJSON() string { - return r.raw +func (r PlacementConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } // Enables @@ -828,17 +587,6 @@ func (r PlacementConfigurationMode) IsKnown() bool { return false } -type PlacementConfigurationParam struct { - // Enables - // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - // Only `"smart"` is currently supported - Mode param.Field[PlacementConfigurationMode] `json:"mode"` -} - -func (r PlacementConfigurationParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type R2Binding struct { // R2 bucket to bind to BucketName string `json:"bucket_name,required"` @@ -868,8 +616,6 @@ func (r r2BindingJSON) RawJSON() string { func (r R2Binding) implementsWorkersBinding() {} -func (r R2Binding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type R2BindingType string @@ -885,27 +631,6 @@ func (r R2BindingType) IsKnown() bool { return false } -type R2BindingParam struct { - // R2 bucket to bind to - BucketName param.Field[string] `json:"bucket_name,required"` - // The class of resource that the binding provides. - Type param.Field[R2BindingType] `json:"type,required"` -} - -func (r R2BindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r R2BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r R2BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r R2BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r R2BindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r R2BindingParam) implementsWorkersBindingItemUnionParam() {} - type ServiceBinding struct { // Optional environment if the Worker utilizes one. Environment string `json:"environment,required"` @@ -938,8 +663,6 @@ func (r serviceBindingJSON) RawJSON() string { func (r ServiceBinding) implementsWorkersBinding() {} -func (r ServiceBinding) implementsWorkersBindingItem() {} - // The class of resource that the binding provides. type ServiceBindingType string @@ -955,119 +678,6 @@ func (r ServiceBindingType) IsKnown() bool { return false } -type ServiceBindingParam struct { - // Optional environment if the Worker utilizes one. - Environment param.Field[string] `json:"environment,required"` - // Name of Worker to bind to - Service param.Field[string] `json:"service,required"` - // The class of resource that the binding provides. - Type param.Field[ServiceBindingType] `json:"type,required"` -} - -func (r ServiceBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {} - -// A single set of migrations to apply. -type SingleStepMigration struct { - // A list of classes to delete Durable Object namespaces from. - DeletedClasses []string `json:"deleted_classes"` - // A list of classes to create Durable Object namespaces from. - NewClasses []string `json:"new_classes"` - // Tag to set as the latest migration tag. - NewTag string `json:"new_tag"` - // Tag used to verify against the latest migration tag for this Worker. If they - // don't match, the upload is rejected. - OldTag string `json:"old_tag"` - // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses []SingleStepMigrationRenamedClass `json:"renamed_classes"` - // A list of transfers for Durable Object namespaces from a different Worker and - // class to a class defined in this Worker. - TransferredClasses []SingleStepMigrationTransferredClass `json:"transferred_classes"` - JSON singleStepMigrationJSON `json:"-"` -} - -// singleStepMigrationJSON contains the JSON metadata for the struct -// [SingleStepMigration] -type singleStepMigrationJSON struct { - DeletedClasses apijson.Field - NewClasses apijson.Field - NewTag apijson.Field - OldTag apijson.Field - RenamedClasses apijson.Field - TransferredClasses apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SingleStepMigration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r singleStepMigrationJSON) RawJSON() string { - return r.raw -} - -func (r SingleStepMigration) implementsWorkersSettingsItemMigrations() {} - -type SingleStepMigrationRenamedClass struct { - From string `json:"from"` - To string `json:"to"` - JSON singleStepMigrationRenamedClassJSON `json:"-"` -} - -// singleStepMigrationRenamedClassJSON contains the JSON metadata for the struct -// [SingleStepMigrationRenamedClass] -type singleStepMigrationRenamedClassJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SingleStepMigrationRenamedClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r singleStepMigrationRenamedClassJSON) RawJSON() string { - return r.raw -} - -type SingleStepMigrationTransferredClass struct { - From string `json:"from"` - FromScript string `json:"from_script"` - To string `json:"to"` - JSON singleStepMigrationTransferredClassJSON `json:"-"` -} - -// singleStepMigrationTransferredClassJSON contains the JSON metadata for the -// struct [SingleStepMigrationTransferredClass] -type singleStepMigrationTransferredClassJSON struct { - From apijson.Field - FromScript apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SingleStepMigrationTransferredClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r singleStepMigrationTransferredClassJSON) RawJSON() string { - return r.raw -} - // A single set of migrations to apply. type SingleStepMigrationParam struct { // A list of classes to delete Durable Object namespaces from. @@ -1093,14 +703,6 @@ func (r SingleStepMigrationParam) MarshalJSON() (data []byte, err error) { func (r SingleStepMigrationParam) implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() { } -func (r SingleStepMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SingleStepMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SingleStepMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SingleStepMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - func (r SingleStepMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() { } @@ -1123,37 +725,6 @@ func (r SingleStepMigrationTransferredClassParam) MarshalJSON() (data []byte, er return apijson.MarshalRoot(r) } -type SteppedMigration struct { - // Tag to set as the latest migration tag. - NewTag string `json:"new_tag"` - // Tag used to verify against the latest migration tag for this Worker. If they - // don't match, the upload is rejected. - OldTag string `json:"old_tag"` - // Migrations to apply in order. - Steps []MigrationStep `json:"steps"` - JSON steppedMigrationJSON `json:"-"` -} - -// steppedMigrationJSON contains the JSON metadata for the struct -// [SteppedMigration] -type steppedMigrationJSON struct { - NewTag apijson.Field - OldTag apijson.Field - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SteppedMigration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r steppedMigrationJSON) RawJSON() string { - return r.raw -} - -func (r SteppedMigration) implementsWorkersSettingsItemMigrations() {} - type SteppedMigrationParam struct { // Tag to set as the latest migration tag. NewTag param.Field[string] `json:"new_tag"` @@ -1170,13 +741,5 @@ func (r SteppedMigrationParam) MarshalJSON() (data []byte, err error) { func (r SteppedMigrationParam) implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() {} -func (r SteppedMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SteppedMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SteppedMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - -func (r SteppedMigrationParam) implementsWorkersSettingsItemMigrationsUnionParam() {} - func (r SteppedMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() { }