diff --git a/.stats.yml b/.stats.yml index cc24d4150ce..6f25ceda630 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1488 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07e0195c449648b13153ed513e99af896a19aa031245e6541b32e077d6536300.yml +configured_endpoints: 1490 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6eed6659daa87db188a6095d59dbc3f6a84c1f63ca4e1b958283301d61cb16e5.yml diff --git a/abuse_reports/abusereport.go b/abuse_reports/abusereport.go index e5d58ddf07e..2ff12a9df09 100644 --- a/abuse_reports/abusereport.go +++ b/abuse_reports/abusereport.go @@ -3,6 +3,14 @@ package abuse_reports import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-go/v3/internal/apijson" + "github.com/cloudflare/cloudflare-go/v3/internal/param" + "github.com/cloudflare/cloudflare-go/v3/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v3/option" ) @@ -24,3 +32,285 @@ func NewAbuseReportService(opts ...option.RequestOption) (r *AbuseReportService) r.Options = opts return } + +// Submit the Abuse Report of a particular type +func (r *AbuseReportService) New(ctx context.Context, reportType AbuseReportNewParamsReportType, params AbuseReportNewParams, opts ...option.RequestOption) (res *string, err error) { + var env AbuseReportNewResponseEnvelope + opts = append(r.Options[:], opts...) + if params.AccountID.Value == "" { + err = errors.New("missing required account_id parameter") + return + } + path := fmt.Sprintf("accounts/%s/v1/abuse-reports/%v", params.AccountID, reportType) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type AbuseReportNewParams struct { + AccountID param.Field[string] `path:"account_id,required"` + // The abuse report type + Act param.Field[AbuseReportNewParamsAct] `json:"act,required"` + // A valid email of the abuse reporter + Email param.Field[string] `json:"email,required"` + // Should match the value provided in `email` + Email2 param.Field[string] `json:"email2,required"` + // Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + // reports cannot be anonymous. + HostNotification param.Field[AbuseReportNewParamsHostNotification] `json:"host_notification,required"` + // Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + // reports cannot be anonymous. + NcmecNotification param.Field[AbuseReportNewParamsNcmecNotification] `json:"ncmec_notification,required"` + // Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + // reports cannot be anonymous. + OwnerNotification param.Field[AbuseReportNewParamsOwnerNotification] `json:"owner_notification,required"` + // A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + // should not exceed 250 URLs. All URLs should have the same hostname. Each URL + // should be unique + URLs param.Field[string] `json:"urls,required"` + // Text not exceeding 100 characters + Address1 param.Field[string] `json:"address1"` + // The name of the copyright holder. Text not exceeding 60 characters. + AgentName param.Field[string] `json:"agent_name"` + // Can be 0 or 1 + Agree param.Field[AbuseReportNewParamsAgree] `json:"agree"` + // Text not exceeding 255 characters + City param.Field[string] `json:"city"` + // Any additional comments about the infringement not exceeding 2000 characters + Comments param.Field[string] `json:"comments"` + // Text not exceeding 100 characters + Company param.Field[string] `json:"company"` + // Text not exceeding 255 characters + Country param.Field[string] `json:"country"` + // A list of IP addresses separated by ‘ ’ (new line character). The list of + // destination IPs should not exceed 30 IP addresses. Each one of the IP addresses + // ought to be unique + DestinationIPs param.Field[string] `json:"destination_ips"` + // A detailed description of the infringement, including any necessary access + // details and the exact steps needed to view the content, not exceeding 5000 + // characters + Justification param.Field[string] `json:"justification"` + // Text not exceeding 255 characters + Name param.Field[string] `json:"name"` + // If the submitter is the target of NCSEI in the URLs of the abuse report + NcseiSubjectRepresentation param.Field[bool] `json:"ncsei_subject_representation"` + // Text not exceeding 255 characters + OriginalWork param.Field[string] `json:"original_work"` + // A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total + // size of the field should not exceed 2000 characters. Each individual + // port/protocol should not exceed 100 characters. The list should not have more + // than 30 unique ports and protocols. + PortsProtocols param.Field[string] `json:"ports_protocols"` + // Required for DMCA reports, should be same as Name. An affirmation that all + // information in the report is true and accurate while agreeing to the policies of + // Cloudflare's abuse reports + Signature param.Field[string] `json:"signature"` + // A list of IP addresses separated by ‘ ’ (new line character). The list of source + // IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be + // unique + SourceIPs param.Field[string] `json:"source_ips"` + // Text not exceeding 255 characters + State param.Field[string] `json:"state"` + // Text not exceeding 20 characters + Tele param.Field[string] `json:"tele"` + // Text not exceeding 255 characters + Title param.Field[string] `json:"title"` + // Text not exceeding 1000 characters + TrademarkNumber param.Field[string] `json:"trademark_number"` + // Text not exceeding 1000 characters + TrademarkOffice param.Field[string] `json:"trademark_office"` + // Text not exceeding 1000 characters + TrademarkSymbol param.Field[string] `json:"trademark_symbol"` +} + +func (r AbuseReportNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The abuse report type +type AbuseReportNewParamsReportType string + +const ( + AbuseReportNewParamsReportTypeAbuseDmca AbuseReportNewParamsReportType = "abuse_dmca" + AbuseReportNewParamsReportTypeAbuseTrademark AbuseReportNewParamsReportType = "abuse_trademark" + AbuseReportNewParamsReportTypeAbuseGeneral AbuseReportNewParamsReportType = "abuse_general" + AbuseReportNewParamsReportTypeAbusePhishing AbuseReportNewParamsReportType = "abuse_phishing" + AbuseReportNewParamsReportTypeAbuseChildren AbuseReportNewParamsReportType = "abuse_children" + AbuseReportNewParamsReportTypeAbuseThreat AbuseReportNewParamsReportType = "abuse_threat" + AbuseReportNewParamsReportTypeAbuseRegistrarWhois AbuseReportNewParamsReportType = "abuse_registrar_whois" + AbuseReportNewParamsReportTypeAbuseNcsei AbuseReportNewParamsReportType = "abuse_ncsei" +) + +func (r AbuseReportNewParamsReportType) IsKnown() bool { + switch r { + case AbuseReportNewParamsReportTypeAbuseDmca, AbuseReportNewParamsReportTypeAbuseTrademark, AbuseReportNewParamsReportTypeAbuseGeneral, AbuseReportNewParamsReportTypeAbusePhishing, AbuseReportNewParamsReportTypeAbuseChildren, AbuseReportNewParamsReportTypeAbuseThreat, AbuseReportNewParamsReportTypeAbuseRegistrarWhois, AbuseReportNewParamsReportTypeAbuseNcsei: + return true + } + return false +} + +// The abuse report type +type AbuseReportNewParamsAct string + +const ( + AbuseReportNewParamsActAbuseDmca AbuseReportNewParamsAct = "abuse_dmca" + AbuseReportNewParamsActAbuseTrademark AbuseReportNewParamsAct = "abuse_trademark" + AbuseReportNewParamsActAbuseGeneral AbuseReportNewParamsAct = "abuse_general" + AbuseReportNewParamsActAbusePhishing AbuseReportNewParamsAct = "abuse_phishing" + AbuseReportNewParamsActAbuseChildren AbuseReportNewParamsAct = "abuse_children" + AbuseReportNewParamsActAbuseThreat AbuseReportNewParamsAct = "abuse_threat" + AbuseReportNewParamsActAbuseRegistrarWhois AbuseReportNewParamsAct = "abuse_registrar_whois" + AbuseReportNewParamsActAbuseNcsei AbuseReportNewParamsAct = "abuse_ncsei" +) + +func (r AbuseReportNewParamsAct) IsKnown() bool { + switch r { + case AbuseReportNewParamsActAbuseDmca, AbuseReportNewParamsActAbuseTrademark, AbuseReportNewParamsActAbuseGeneral, AbuseReportNewParamsActAbusePhishing, AbuseReportNewParamsActAbuseChildren, AbuseReportNewParamsActAbuseThreat, AbuseReportNewParamsActAbuseRegistrarWhois, AbuseReportNewParamsActAbuseNcsei: + return true + } + return false +} + +// Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark +// reports cannot be anonymous. +type AbuseReportNewParamsHostNotification string + +const ( + AbuseReportNewParamsHostNotificationSend AbuseReportNewParamsHostNotification = "send" + AbuseReportNewParamsHostNotificationSendAnon AbuseReportNewParamsHostNotification = "send-anon" + AbuseReportNewParamsHostNotificationNone AbuseReportNewParamsHostNotification = "none" +) + +func (r AbuseReportNewParamsHostNotification) IsKnown() bool { + switch r { + case AbuseReportNewParamsHostNotificationSend, AbuseReportNewParamsHostNotificationSendAnon, AbuseReportNewParamsHostNotificationNone: + return true + } + return false +} + +// Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark +// reports cannot be anonymous. +type AbuseReportNewParamsNcmecNotification string + +const ( + AbuseReportNewParamsNcmecNotificationSend AbuseReportNewParamsNcmecNotification = "send" + AbuseReportNewParamsNcmecNotificationSendAnon AbuseReportNewParamsNcmecNotification = "send-anon" + AbuseReportNewParamsNcmecNotificationNone AbuseReportNewParamsNcmecNotification = "none" +) + +func (r AbuseReportNewParamsNcmecNotification) IsKnown() bool { + switch r { + case AbuseReportNewParamsNcmecNotificationSend, AbuseReportNewParamsNcmecNotificationSendAnon, AbuseReportNewParamsNcmecNotificationNone: + return true + } + return false +} + +// Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark +// reports cannot be anonymous. +type AbuseReportNewParamsOwnerNotification string + +const ( + AbuseReportNewParamsOwnerNotificationSend AbuseReportNewParamsOwnerNotification = "send" + AbuseReportNewParamsOwnerNotificationSendAnon AbuseReportNewParamsOwnerNotification = "send-anon" + AbuseReportNewParamsOwnerNotificationNone AbuseReportNewParamsOwnerNotification = "none" +) + +func (r AbuseReportNewParamsOwnerNotification) IsKnown() bool { + switch r { + case AbuseReportNewParamsOwnerNotificationSend, AbuseReportNewParamsOwnerNotificationSendAnon, AbuseReportNewParamsOwnerNotificationNone: + return true + } + return false +} + +// Can be 0 or 1 +type AbuseReportNewParamsAgree int64 + +const ( + AbuseReportNewParamsAgree0 AbuseReportNewParamsAgree = 0 + AbuseReportNewParamsAgree1 AbuseReportNewParamsAgree = 1 +) + +func (r AbuseReportNewParamsAgree) IsKnown() bool { + switch r { + case AbuseReportNewParamsAgree0, AbuseReportNewParamsAgree1: + return true + } + return false +} + +type AbuseReportNewResponseEnvelope struct { + // The identifier for the submitted abuse report. + AbuseRand string `json:"abuse_rand,required"` + Request AbuseReportNewResponseEnvelopeRequest `json:"request,required"` + // The result should be 'success' for successful response + Result string `json:"result,required"` + JSON abuseReportNewResponseEnvelopeJSON `json:"-"` +} + +// abuseReportNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [AbuseReportNewResponseEnvelope] +type abuseReportNewResponseEnvelopeJSON struct { + AbuseRand apijson.Field + Request apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AbuseReportNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r abuseReportNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type AbuseReportNewResponseEnvelopeRequest struct { + // The abuse report type + Act AbuseReportNewResponseEnvelopeRequestAct `json:"act,required"` + JSON abuseReportNewResponseEnvelopeRequestJSON `json:"-"` +} + +// abuseReportNewResponseEnvelopeRequestJSON contains the JSON metadata for the +// struct [AbuseReportNewResponseEnvelopeRequest] +type abuseReportNewResponseEnvelopeRequestJSON struct { + Act apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AbuseReportNewResponseEnvelopeRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r abuseReportNewResponseEnvelopeRequestJSON) RawJSON() string { + return r.raw +} + +// The abuse report type +type AbuseReportNewResponseEnvelopeRequestAct string + +const ( + AbuseReportNewResponseEnvelopeRequestActAbuseDmca AbuseReportNewResponseEnvelopeRequestAct = "abuse_dmca" + AbuseReportNewResponseEnvelopeRequestActAbuseTrademark AbuseReportNewResponseEnvelopeRequestAct = "abuse_trademark" + AbuseReportNewResponseEnvelopeRequestActAbuseGeneral AbuseReportNewResponseEnvelopeRequestAct = "abuse_general" + AbuseReportNewResponseEnvelopeRequestActAbusePhishing AbuseReportNewResponseEnvelopeRequestAct = "abuse_phishing" + AbuseReportNewResponseEnvelopeRequestActAbuseChildren AbuseReportNewResponseEnvelopeRequestAct = "abuse_children" + AbuseReportNewResponseEnvelopeRequestActAbuseThreat AbuseReportNewResponseEnvelopeRequestAct = "abuse_threat" + AbuseReportNewResponseEnvelopeRequestActAbuseRegistrarWhois AbuseReportNewResponseEnvelopeRequestAct = "abuse_registrar_whois" + AbuseReportNewResponseEnvelopeRequestActAbuseNcsei AbuseReportNewResponseEnvelopeRequestAct = "abuse_ncsei" +) + +func (r AbuseReportNewResponseEnvelopeRequestAct) IsKnown() bool { + switch r { + case AbuseReportNewResponseEnvelopeRequestActAbuseDmca, AbuseReportNewResponseEnvelopeRequestActAbuseTrademark, AbuseReportNewResponseEnvelopeRequestActAbuseGeneral, AbuseReportNewResponseEnvelopeRequestActAbusePhishing, AbuseReportNewResponseEnvelopeRequestActAbuseChildren, AbuseReportNewResponseEnvelopeRequestActAbuseThreat, AbuseReportNewResponseEnvelopeRequestActAbuseRegistrarWhois, AbuseReportNewResponseEnvelopeRequestActAbuseNcsei: + return true + } + return false +} diff --git a/abuse_reports/abusereport_test.go b/abuse_reports/abusereport_test.go new file mode 100644 index 00000000000..44bff446665 --- /dev/null +++ b/abuse_reports/abusereport_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package abuse_reports_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-go/v3" + "github.com/cloudflare/cloudflare-go/v3/abuse_reports" + "github.com/cloudflare/cloudflare-go/v3/internal/testutil" + "github.com/cloudflare/cloudflare-go/v3/option" +) + +func TestAbuseReportNewWithOptionalParams(t *testing.T) { + t.Skip("TODO: investigate unauthorized HTTP response") + 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.AbuseReports.New( + context.TODO(), + abuse_reports.AbuseReportNewParamsReportTypeAbuseDmca, + abuse_reports.AbuseReportNewParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Act: cloudflare.F(abuse_reports.AbuseReportNewParamsActAbuseDmca), + Email: cloudflare.F("email"), + Email2: cloudflare.F("email2"), + HostNotification: cloudflare.F(abuse_reports.AbuseReportNewParamsHostNotificationSend), + NcmecNotification: cloudflare.F(abuse_reports.AbuseReportNewParamsNcmecNotificationSend), + OwnerNotification: cloudflare.F(abuse_reports.AbuseReportNewParamsOwnerNotificationSend), + URLs: cloudflare.F("urls"), + Address1: cloudflare.F("x"), + AgentName: cloudflare.F("x"), + Agree: cloudflare.F(abuse_reports.AbuseReportNewParamsAgree0), + City: cloudflare.F("x"), + Comments: cloudflare.F("x"), + Company: cloudflare.F("x"), + Country: cloudflare.F("x"), + DestinationIPs: cloudflare.F("destination_ips"), + Justification: cloudflare.F("x"), + Name: cloudflare.F("x"), + NcseiSubjectRepresentation: cloudflare.F(true), + OriginalWork: cloudflare.F("x"), + PortsProtocols: cloudflare.F("ports_protocols"), + Signature: cloudflare.F("signature"), + SourceIPs: cloudflare.F("source_ips"), + State: cloudflare.F("x"), + Tele: cloudflare.F("x"), + Title: cloudflare.F("x"), + TrademarkNumber: cloudflare.F("x"), + TrademarkOffice: cloudflare.F("x"), + TrademarkSymbol: cloudflare.F("x"), + }, + ) + 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/addressing/addressmap.go b/addressing/addressmap.go index 9e8b2b8e81d..6a5bf018eaa 100644 --- a/addressing/addressmap.go +++ b/addressing/addressmap.go @@ -146,7 +146,7 @@ func (r *AddressMapService) Get(ctx context.Context, addressMapID string, query } type AddressMap struct { - // Identifier of an Address Map. + // Identifier ID string `json:"id"` // If set to false, then the Address Map cannot be deleted via API. This is true // for Cloudflare-managed maps. @@ -210,7 +210,7 @@ func (r Kind) IsKnown() bool { } type AddressMapNewResponse struct { - // Identifier of an Address Map. + // Identifier ID string `json:"id"` // If set to false, then the Address Map cannot be deleted via API. This is true // for Cloudflare-managed maps. @@ -394,7 +394,7 @@ func (r addressMapDeleteResponseResultInfoJSON) RawJSON() string { } type AddressMapGetResponse struct { - // Identifier of an Address Map. + // Identifier ID string `json:"id"` // If set to false, then the Address Map cannot be deleted via API. This is true // for Cloudflare-managed maps. @@ -504,7 +504,7 @@ func (r addressMapGetResponseMembershipJSON) RawJSON() string { } type AddressMapNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // An optional description field which may be used to describe the types of IPs or // zones on the map. @@ -577,17 +577,17 @@ func (r AddressMapNewResponseEnvelopeSuccess) IsKnown() bool { } type AddressMapListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type AddressMapDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type AddressMapEditParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // If you have legacy TLS clients which do not send the TLS server name indicator, // then you can specify one default SNI on the map. If Cloudflare receives a TLS @@ -651,7 +651,7 @@ func (r AddressMapEditResponseEnvelopeSuccess) IsKnown() bool { } type AddressMapGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/addressmap_test.go b/addressing/addressmap_test.go index cb702dc30ed..386f80ad8d9 100644 --- a/addressing/addressmap_test.go +++ b/addressing/addressmap_test.go @@ -28,7 +28,7 @@ func TestAddressMapNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.AddressMaps.New(context.TODO(), addressing.AddressMapNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Description: cloudflare.F("My Ecommerce zones"), Enabled: cloudflare.F(true), IPs: cloudflare.F([]string{"192.0.2.1"}), @@ -60,7 +60,7 @@ func TestAddressMapList(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.AddressMaps.List(context.TODO(), addressing.AddressMapListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { var apierr *cloudflare.Error @@ -86,9 +86,9 @@ func TestAddressMapDelete(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Delete( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -115,9 +115,9 @@ func TestAddressMapEditWithOptionalParams(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Edit( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapEditParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), DefaultSNI: cloudflare.F("*.example.com"), Description: cloudflare.F("My Ecommerce zones"), Enabled: cloudflare.F(true), @@ -147,9 +147,9 @@ func TestAddressMapGet(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Get( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/addressmapaccount.go b/addressing/addressmapaccount.go index 8191e0e447f..ed6a8338503 100644 --- a/addressing/addressmapaccount.go +++ b/addressing/addressmapaccount.go @@ -215,7 +215,7 @@ func (r addressMapAccountDeleteResponseResultInfoJSON) RawJSON() string { } type AddressMapAccountUpdateParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` Body interface{} `json:"body,required"` } @@ -225,6 +225,6 @@ func (r AddressMapAccountUpdateParams) MarshalJSON() (data []byte, err error) { } type AddressMapAccountDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/addressmapaccount_test.go b/addressing/addressmapaccount_test.go index a6f2171f403..96054bf8fd6 100644 --- a/addressing/addressmapaccount_test.go +++ b/addressing/addressmapaccount_test.go @@ -29,9 +29,9 @@ func TestAddressMapAccountUpdate(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Accounts.Update( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapAccountUpdateParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{}, }, ) @@ -59,9 +59,9 @@ func TestAddressMapAccountDelete(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Accounts.Delete( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapAccountDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/addressmapip.go b/addressing/addressmapip.go index b2116d4e4e5..9e81212cddc 100644 --- a/addressing/addressmapip.go +++ b/addressing/addressmapip.go @@ -223,7 +223,7 @@ func (r addressMapIPDeleteResponseResultInfoJSON) RawJSON() string { } type AddressMapIPUpdateParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` Body interface{} `json:"body,required"` } @@ -233,6 +233,6 @@ func (r AddressMapIPUpdateParams) MarshalJSON() (data []byte, err error) { } type AddressMapIPDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/addressmapip_test.go b/addressing/addressmapip_test.go index 3baec2d7c36..b140841324a 100644 --- a/addressing/addressmapip_test.go +++ b/addressing/addressmapip_test.go @@ -29,10 +29,10 @@ func TestAddressMapIPUpdate(t *testing.T) { ) _, err := client.Addressing.AddressMaps.IPs.Update( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", "192.0.2.1", addressing.AddressMapIPUpdateParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{}, }, ) @@ -60,10 +60,10 @@ func TestAddressMapIPDelete(t *testing.T) { ) _, err := client.Addressing.AddressMaps.IPs.Delete( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", "192.0.2.1", addressing.AddressMapIPDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/addressmapzone.go b/addressing/addressmapzone.go index e4e820d189d..b6d003adf40 100644 --- a/addressing/addressmapzone.go +++ b/addressing/addressmapzone.go @@ -223,9 +223,9 @@ func (r addressMapZoneDeleteResponseResultInfoJSON) RawJSON() string { } type AddressMapZoneUpdateParams struct { - // Identifier of a zone. + // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` Body interface{} `json:"body,required"` } @@ -235,8 +235,8 @@ func (r AddressMapZoneUpdateParams) MarshalJSON() (data []byte, err error) { } type AddressMapZoneDeleteParams struct { - // Identifier of a zone. + // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/addressmapzone_test.go b/addressing/addressmapzone_test.go index 9d2b4e9cc24..f1090d2e756 100644 --- a/addressing/addressmapzone_test.go +++ b/addressing/addressmapzone_test.go @@ -29,10 +29,10 @@ func TestAddressMapZoneUpdate(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Zones.Update( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapZoneUpdateParams{ - ZoneID: cloudflare.F("8ac8489932db6327334c9b6d58544cfe"), - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{}, }, ) @@ -60,10 +60,10 @@ func TestAddressMapZoneDelete(t *testing.T) { ) _, err := client.Addressing.AddressMaps.Zones.Delete( context.TODO(), - "055817b111884e0227e1be16a0be6ee0", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapZoneDeleteParams{ - ZoneID: cloudflare.F("8ac8489932db6327334c9b6d58544cfe"), - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/loadocument.go b/addressing/loadocument.go index cd88b2b612b..a5f839f3de0 100644 --- a/addressing/loadocument.go +++ b/addressing/loadocument.go @@ -75,7 +75,7 @@ func (r *LOADocumentService) Get(ctx context.Context, loaDocumentID string, quer type LOADocumentNewResponse struct { // Identifier for the uploaded LOA document. ID string `json:"id,nullable"` - // Identifier of a Cloudflare account. + // Identifier AccountID string `json:"account_id"` Created time.Time `json:"created" format:"date-time"` // Name of LOA document. Max file size 10MB, and supported filetype is pdf. @@ -112,7 +112,7 @@ func (r loaDocumentNewResponseJSON) RawJSON() string { } type LOADocumentNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // LOA document to upload. LOADocument param.Field[string] `json:"loa_document,required"` @@ -177,6 +177,6 @@ func (r LOADocumentNewResponseEnvelopeSuccess) IsKnown() bool { } type LOADocumentGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/loadocument_test.go b/addressing/loadocument_test.go index 1969d858439..1c2c1761001 100644 --- a/addressing/loadocument_test.go +++ b/addressing/loadocument_test.go @@ -33,7 +33,7 @@ func TestLOADocumentNew(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.LOADocuments.New(context.TODO(), addressing.LOADocumentNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), LOADocument: cloudflare.F("@document.pdf"), }) if err != nil { @@ -62,7 +62,7 @@ func TestLOADocumentGet(t *testing.T) { context.TODO(), "d933b1530bc56c9953cf8ce166da8004", addressing.LOADocumentGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/prefix.go b/addressing/prefix.go index 1e452ac11ee..c74375c5e6e 100644 --- a/addressing/prefix.go +++ b/addressing/prefix.go @@ -147,9 +147,9 @@ func (r *PrefixService) Get(ctx context.Context, prefixID string, query PrefixGe } type Prefix struct { - // Identifier of an IP Prefix. + // Identifier ID string `json:"id"` - // Identifier of a Cloudflare account. + // Identifier AccountID string `json:"account_id"` // Prefix advertisement status to the Internet. This field is only not 'null' if on // demand is enabled. @@ -280,7 +280,7 @@ func (r prefixDeleteResponseResultInfoJSON) RawJSON() string { } type PrefixNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // Autonomous System Number (ASN) the prefix will be advertised under. ASN param.Field[int64] `json:"asn,required"` @@ -338,17 +338,17 @@ func (r PrefixNewResponseEnvelopeSuccess) IsKnown() bool { } type PrefixListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixEditParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // Description of the prefix. Description param.Field[string] `json:"description,required"` @@ -402,7 +402,7 @@ func (r PrefixEditResponseEnvelopeSuccess) IsKnown() bool { } type PrefixGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/prefix_test.go b/addressing/prefix_test.go index 70f61d59f79..3ccc14e4fa6 100644 --- a/addressing/prefix_test.go +++ b/addressing/prefix_test.go @@ -28,7 +28,7 @@ func TestPrefixNew(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.Prefixes.New(context.TODO(), addressing.PrefixNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ASN: cloudflare.F(int64(209242)), CIDR: cloudflare.F("192.0.2.0/24"), LOADocumentID: cloudflare.F("d933b1530bc56c9953cf8ce166da8004"), @@ -56,7 +56,7 @@ func TestPrefixList(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.Prefixes.List(context.TODO(), addressing.PrefixListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { var apierr *cloudflare.Error @@ -82,9 +82,9 @@ func TestPrefixDelete(t *testing.T) { ) _, err := client.Addressing.Prefixes.Delete( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -111,9 +111,9 @@ func TestPrefixEdit(t *testing.T) { ) _, err := client.Addressing.Prefixes.Edit( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixEditParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Description: cloudflare.F("Internal test prefix"), }, ) @@ -141,9 +141,9 @@ func TestPrefixGet(t *testing.T) { ) _, err := client.Addressing.Prefixes.Get( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/prefixadvertisementstatus.go b/addressing/prefixadvertisementstatus.go index 32fdb4cafaf..274b96dbedd 100644 --- a/addressing/prefixadvertisementstatus.go +++ b/addressing/prefixadvertisementstatus.go @@ -35,10 +35,7 @@ func NewPrefixAdvertisementStatusService(opts ...option.RequestOption) (r *Prefi return } -// Advertise or withdraw the BGP route for a prefix. -// -// **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for -// advertising and withdrawing subnets of an IP prefix. +// Advertise or withdraw BGP route for a prefix. func (r *PrefixAdvertisementStatusService) Edit(ctx context.Context, prefixID string, params PrefixAdvertisementStatusEditParams, opts ...option.RequestOption) (res *PrefixAdvertisementStatusEditResponse, err error) { var env PrefixAdvertisementStatusEditResponseEnvelope opts = append(r.Options[:], opts...) @@ -59,10 +56,7 @@ func (r *PrefixAdvertisementStatusService) Edit(ctx context.Context, prefixID st return } -// View the current advertisement state for a prefix. -// -// **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for -// advertising and withdrawing subnets of an IP prefix. +// List the current advertisement state for a prefix. func (r *PrefixAdvertisementStatusService) Get(ctx context.Context, prefixID string, query PrefixAdvertisementStatusGetParams, opts ...option.RequestOption) (res *PrefixAdvertisementStatusGetResponse, err error) { var env PrefixAdvertisementStatusGetResponseEnvelope opts = append(r.Options[:], opts...) @@ -84,8 +78,7 @@ func (r *PrefixAdvertisementStatusService) Get(ctx context.Context, prefixID str } type PrefixAdvertisementStatusEditResponse struct { - // Advertisement status of the prefix. If `true`, the BGP route for the prefix is - // advertised to the Internet. If `false`, the BGP route is withdrawn. + // Enablement of prefix advertisement to the Internet. Advertised bool `json:"advertised"` // Last time the advertisement status was changed. This field is only not 'null' if // on demand is enabled. @@ -111,8 +104,7 @@ func (r prefixAdvertisementStatusEditResponseJSON) RawJSON() string { } type PrefixAdvertisementStatusGetResponse struct { - // Advertisement status of the prefix. If `true`, the BGP route for the prefix is - // advertised to the Internet. If `false`, the BGP route is withdrawn. + // Enablement of prefix advertisement to the Internet. Advertised bool `json:"advertised"` // Last time the advertisement status was changed. This field is only not 'null' if // on demand is enabled. @@ -138,10 +130,9 @@ func (r prefixAdvertisementStatusGetResponseJSON) RawJSON() string { } type PrefixAdvertisementStatusEditParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` - // Advertisement status of the prefix. If `true`, the BGP route for the prefix is - // advertised to the Internet. If `false`, the BGP route is withdrawn. + // Enablement of prefix advertisement to the Internet. Advertised param.Field[bool] `json:"advertised,required"` } @@ -193,7 +184,7 @@ func (r PrefixAdvertisementStatusEditResponseEnvelopeSuccess) IsKnown() bool { } type PrefixAdvertisementStatusGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/prefixadvertisementstatus_test.go b/addressing/prefixadvertisementstatus_test.go index cacf0391a53..996dd32d27a 100644 --- a/addressing/prefixadvertisementstatus_test.go +++ b/addressing/prefixadvertisementstatus_test.go @@ -29,9 +29,9 @@ func TestPrefixAdvertisementStatusEdit(t *testing.T) { ) _, err := client.Addressing.Prefixes.AdvertisementStatus.Edit( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixAdvertisementStatusEditParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Advertised: cloudflare.F(true), }, ) @@ -59,9 +59,9 @@ func TestPrefixAdvertisementStatusGet(t *testing.T) { ) _, err := client.Addressing.Prefixes.AdvertisementStatus.Get( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixAdvertisementStatusGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/prefixbgpprefix.go b/addressing/prefixbgpprefix.go index bcadfb15adf..2e32e5ad9b2 100644 --- a/addressing/prefixbgpprefix.go +++ b/addressing/prefixbgpprefix.go @@ -148,7 +148,7 @@ func (r *PrefixBGPPrefixService) Get(ctx context.Context, prefixID string, bgpPr } type BGPPrefix struct { - // Identifier of BGP Prefix. + // Identifier ID string `json:"id"` // Autonomous System Number (ASN) the prefix will be advertised under. ASN int64 `json:"asn,nullable"` @@ -245,7 +245,7 @@ func (r bgpPrefixOnDemandJSON) RawJSON() string { } type PrefixBGPPrefixNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // IP Prefix in Classless Inter-Domain Routing format. CIDR param.Field[string] `json:"cidr"` @@ -299,12 +299,12 @@ func (r PrefixBGPPrefixNewResponseEnvelopeSuccess) IsKnown() bool { } type PrefixBGPPrefixListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixBGPPrefixEditParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` OnDemand param.Field[PrefixBGPPrefixEditParamsOnDemand] `json:"on_demand"` } @@ -365,7 +365,7 @@ func (r PrefixBGPPrefixEditResponseEnvelopeSuccess) IsKnown() bool { } type PrefixBGPPrefixGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/prefixbgpprefix_test.go b/addressing/prefixbgpprefix_test.go index 6a81dd0b92e..77482935041 100644 --- a/addressing/prefixbgpprefix_test.go +++ b/addressing/prefixbgpprefix_test.go @@ -29,9 +29,9 @@ func TestPrefixBGPPrefixNewWithOptionalParams(t *testing.T) { ) _, err := client.Addressing.Prefixes.BGPPrefixes.New( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixBGPPrefixNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CIDR: cloudflare.F("192.0.2.0/24"), }, ) @@ -59,9 +59,9 @@ func TestPrefixBGPPrefixList(t *testing.T) { ) _, err := client.Addressing.Prefixes.BGPPrefixes.List( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixBGPPrefixListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -88,10 +88,10 @@ func TestPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { ) _, err := client.Addressing.Prefixes.BGPPrefixes.Edit( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", - "7009ba364c7a5760798ceb430e603b74", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixBGPPrefixEditParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), OnDemand: cloudflare.F(addressing.PrefixBGPPrefixEditParamsOnDemand{ Advertised: cloudflare.F(true), }), @@ -121,10 +121,10 @@ func TestPrefixBGPPrefixGet(t *testing.T) { ) _, err := client.Addressing.Prefixes.BGPPrefixes.Get( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", - "7009ba364c7a5760798ceb430e603b74", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixBGPPrefixGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/prefixdelegation.go b/addressing/prefixdelegation.go index f75ef0812a9..40c0ba82289 100644 --- a/addressing/prefixdelegation.go +++ b/addressing/prefixdelegation.go @@ -114,7 +114,7 @@ func (r *PrefixDelegationService) Delete(ctx context.Context, prefixID string, d } type Delegations struct { - // Identifier of a Delegation. + // Delegation identifier tag. ID string `json:"id"` // IP Prefix in Classless Inter-Domain Routing format. CIDR string `json:"cidr"` @@ -122,7 +122,7 @@ type Delegations struct { // Account identifier for the account to which prefix is being delegated. DelegatedAccountID string `json:"delegated_account_id"` ModifiedAt time.Time `json:"modified_at" format:"date-time"` - // Identifier of an IP Prefix. + // Identifier ParentPrefixID string `json:"parent_prefix_id"` JSON delegationsJSON `json:"-"` } @@ -148,7 +148,7 @@ func (r delegationsJSON) RawJSON() string { } type PrefixDelegationDeleteResponse struct { - // Identifier of a Delegation. + // Delegation identifier tag. ID string `json:"id"` JSON prefixDelegationDeleteResponseJSON `json:"-"` } @@ -170,7 +170,7 @@ func (r prefixDelegationDeleteResponseJSON) RawJSON() string { } type PrefixDelegationNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // IP Prefix in Classless Inter-Domain Routing format. CIDR param.Field[string] `json:"cidr,required"` @@ -226,12 +226,12 @@ func (r PrefixDelegationNewResponseEnvelopeSuccess) IsKnown() bool { } type PrefixDelegationListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixDelegationDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/prefixdelegation_test.go b/addressing/prefixdelegation_test.go index 2a5736b43cf..deafcdff25e 100644 --- a/addressing/prefixdelegation_test.go +++ b/addressing/prefixdelegation_test.go @@ -29,9 +29,9 @@ func TestPrefixDelegationNew(t *testing.T) { ) _, err := client.Addressing.Prefixes.Delegations.New( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixDelegationNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CIDR: cloudflare.F("192.0.2.0/24"), DelegatedAccountID: cloudflare.F("b1946ac92492d2347c6235b4d2611184"), }, @@ -60,9 +60,9 @@ func TestPrefixDelegationList(t *testing.T) { ) _, err := client.Addressing.Prefixes.Delegations.List( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixDelegationListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -89,10 +89,10 @@ func TestPrefixDelegationDelete(t *testing.T) { ) _, err := client.Addressing.Prefixes.Delegations.Delete( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", "d933b1530bc56c9953cf8ce166da8004", addressing.PrefixDelegationDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/prefixservicebinding.go b/addressing/prefixservicebinding.go index 3bb5d61cd76..b913e2d9a4c 100644 --- a/addressing/prefixservicebinding.go +++ b/addressing/prefixservicebinding.go @@ -146,14 +146,13 @@ func (r *PrefixServiceBindingService) Get(ctx context.Context, prefixID string, } type ServiceBinding struct { - // Identifier of a Service Binding. + // Identifier ID string `json:"id"` // IP Prefix in Classless Inter-Domain Routing format. CIDR string `json:"cidr"` // Status of a Service Binding's deployment to the Cloudflare network Provisioning ServiceBindingProvisioning `json:"provisioning"` - // Identifier of a Service on the Cloudflare network. Available services and their - // IDs may be found in the **List Services** endpoint. + // Identifier ServiceID string `json:"service_id"` // Name of a service running on the Cloudflare network ServiceName string `json:"service_name"` @@ -262,12 +261,11 @@ func (r PrefixServiceBindingDeleteResponseSuccess) IsKnown() bool { } type PrefixServiceBindingNewParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` // IP Prefix in Classless Inter-Domain Routing format. CIDR param.Field[string] `json:"cidr"` - // Identifier of a Service on the Cloudflare network. Available services and their - // IDs may be found in the **List Services** endpoint. + // Identifier ServiceID param.Field[string] `json:"service_id"` } @@ -319,17 +317,17 @@ func (r PrefixServiceBindingNewResponseEnvelopeSuccess) IsKnown() bool { } type PrefixServiceBindingListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixServiceBindingDeleteParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } type PrefixServiceBindingGetParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/prefixservicebinding_test.go b/addressing/prefixservicebinding_test.go index dc829afed40..c0c764078d6 100644 --- a/addressing/prefixservicebinding_test.go +++ b/addressing/prefixservicebinding_test.go @@ -29,9 +29,9 @@ func TestPrefixServiceBindingNewWithOptionalParams(t *testing.T) { ) _, err := client.Addressing.Prefixes.ServiceBindings.New( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixServiceBindingNewParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CIDR: cloudflare.F("192.0.2.0/24"), ServiceID: cloudflare.F("2db684ee7ca04e159946fd05b99e1bcd"), }, @@ -60,9 +60,9 @@ func TestPrefixServiceBindingList(t *testing.T) { ) _, err := client.Addressing.Prefixes.ServiceBindings.List( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixServiceBindingListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -89,10 +89,10 @@ func TestPrefixServiceBindingDelete(t *testing.T) { ) _, err := client.Addressing.Prefixes.ServiceBindings.Delete( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", - "0429b49b6a5155297b78e75a44b09e14", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixServiceBindingDeleteParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { @@ -119,10 +119,10 @@ func TestPrefixServiceBindingGet(t *testing.T) { ) _, err := client.Addressing.Prefixes.ServiceBindings.Get( context.TODO(), - "2af39739cc4e3b5910c918468bb89828", - "0429b49b6a5155297b78e75a44b09e14", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixServiceBindingGetParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/addressing/service.go b/addressing/service.go index 247fb95d3ae..d98787385b0 100644 --- a/addressing/service.go +++ b/addressing/service.go @@ -68,8 +68,7 @@ func (r *ServiceService) ListAutoPaging(ctx context.Context, query ServiceListPa } type ServiceListResponse struct { - // Identifier of a Service on the Cloudflare network. Available services and their - // IDs may be found in the **List Services** endpoint. + // Identifier ID string `json:"id"` // Name of a service running on the Cloudflare network Name string `json:"name"` @@ -94,6 +93,6 @@ func (r serviceListResponseJSON) RawJSON() string { } type ServiceListParams struct { - // Identifier of a Cloudflare account. + // Identifier AccountID param.Field[string] `path:"account_id,required"` } diff --git a/addressing/service_test.go b/addressing/service_test.go index f50e9a3cb9b..f1c56bf79d8 100644 --- a/addressing/service_test.go +++ b/addressing/service_test.go @@ -28,7 +28,7 @@ func TestServiceList(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Addressing.Services.List(context.TODO(), addressing.ServiceListParams{ - AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { var apierr *cloudflare.Error diff --git a/api.md b/api.md index 182c3c9a532..05b2ad61a39 100644 --- a/api.md +++ b/api.md @@ -7077,10 +7077,12 @@ Methods: Response Types: +- origin_post_quantum_encryption.OriginPostQuantumEncryptionEditResponse - origin_post_quantum_encryption.OriginPostQuantumEncryptionGetResponse Methods: +- client.OriginPostQuantumEncryption.Edit(ctx context.Context, params origin_post_quantum_encryption.OriginPostQuantumEncryptionEditParams) (origin_post_quantum_encryption.OriginPostQuantumEncryptionEditResponse, error) - client.OriginPostQuantumEncryption.Get(ctx context.Context, query origin_post_quantum_encryption.OriginPostQuantumEncryptionGetParams) (origin_post_quantum_encryption.OriginPostQuantumEncryptionGetResponse, error) # Speed @@ -7658,6 +7660,10 @@ Methods: # AbuseReports +Methods: + +- client.AbuseReports.New(ctx context.Context, reportType abuse_reports.AbuseReportNewParamsReportType, params abuse_reports.AbuseReportNewParams) (string, error) + # AI Response Types: diff --git a/dns/record.go b/dns/record.go index 2171a5663c0..09e6d0f4dca 100644 --- a/dns/record.go +++ b/dns/record.go @@ -1702,7 +1702,7 @@ func (r cnameRecordJSON) RawJSON() string { type CNAMERecordSettings struct { // If enabled, causes the CNAME record to be resolved externally and the resulting // address records (e.g., A and AAAA) to be returned instead of the CNAME record - // itself. This setting is unavailable for proxied records, since they are always + // itself. This setting has no effect on proxied records, which are always // flattened. FlattenCNAME bool `json:"flatten_cname"` // When enabled, only A records will be generated, and AAAA records will not be @@ -1784,7 +1784,7 @@ func (r CNAMERecordParam) implementsDNSRecordUnionParam() {} type CNAMERecordSettingsParam struct { // If enabled, causes the CNAME record to be resolved externally and the resulting // address records (e.g., A and AAAA) to be returned instead of the CNAME record - // itself. This setting is unavailable for proxied records, since they are always + // itself. This setting has no effect on proxied records, which are always // flattened. FlattenCNAME param.Field[bool] `json:"flatten_cname"` // When enabled, only A records will be generated, and AAAA records will not be diff --git a/origin_post_quantum_encryption/originpostquantumencryption.go b/origin_post_quantum_encryption/originpostquantumencryption.go index 7f677f4c9cb..0d8a234820e 100644 --- a/origin_post_quantum_encryption/originpostquantumencryption.go +++ b/origin_post_quantum_encryption/originpostquantumencryption.go @@ -35,6 +35,28 @@ func NewOriginPostQuantumEncryptionService(opts ...option.RequestOption) (r *Ori return } +// Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when +// connecting to your origin. Preferred instructs Cloudflare to opportunistically +// send a Post-Quantum keyshare in the first message to the origin (for fastest +// connections when the origin supports and prefers PQ), supported means that PQ +// algorithms are advertised but only used when requested by the origin, and off +// means that PQ algorithms are not advertised +func (r *OriginPostQuantumEncryptionService) Edit(ctx context.Context, params OriginPostQuantumEncryptionEditParams, opts ...option.RequestOption) (res *OriginPostQuantumEncryptionEditResponse, err error) { + var env OriginPostQuantumEncryptionEditResponseEnvelope + opts = append(r.Options[:], opts...) + if params.ZoneID.Value == "" { + err = errors.New("missing required zone_id parameter") + return + } + path := fmt.Sprintf("zones/%s/cache/origin_post_quantum_encryption", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + // Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when // connecting to your origin. Preferred instructs Cloudflare to opportunistically // send a Post-Quantum keyshare in the first message to the origin (for fastest @@ -57,6 +79,69 @@ func (r *OriginPostQuantumEncryptionService) Get(ctx context.Context, query Orig return } +type OriginPostQuantumEncryptionEditResponse struct { + // Value of the zone setting. + ID OriginPostQuantumEncryptionEditResponseID `json:"id,required"` + // Whether the setting is editable + Editable bool `json:"editable,required"` + // The value of the feature + Value OriginPostQuantumEncryptionEditResponseValue `json:"value,required"` + // Last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON originPostQuantumEncryptionEditResponseJSON `json:"-"` +} + +// originPostQuantumEncryptionEditResponseJSON contains the JSON metadata for the +// struct [OriginPostQuantumEncryptionEditResponse] +type originPostQuantumEncryptionEditResponseJSON struct { + ID apijson.Field + Editable apijson.Field + Value apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OriginPostQuantumEncryptionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r originPostQuantumEncryptionEditResponseJSON) RawJSON() string { + return r.raw +} + +// Value of the zone setting. +type OriginPostQuantumEncryptionEditResponseID string + +const ( + OriginPostQuantumEncryptionEditResponseIDOriginPqe OriginPostQuantumEncryptionEditResponseID = "origin_pqe" +) + +func (r OriginPostQuantumEncryptionEditResponseID) IsKnown() bool { + switch r { + case OriginPostQuantumEncryptionEditResponseIDOriginPqe: + return true + } + return false +} + +// The value of the feature +type OriginPostQuantumEncryptionEditResponseValue string + +const ( + OriginPostQuantumEncryptionEditResponseValuePreferred OriginPostQuantumEncryptionEditResponseValue = "preferred" + OriginPostQuantumEncryptionEditResponseValueSupported OriginPostQuantumEncryptionEditResponseValue = "supported" + OriginPostQuantumEncryptionEditResponseValueOff OriginPostQuantumEncryptionEditResponseValue = "off" +) + +func (r OriginPostQuantumEncryptionEditResponseValue) IsKnown() bool { + switch r { + case OriginPostQuantumEncryptionEditResponseValuePreferred, OriginPostQuantumEncryptionEditResponseValueSupported, OriginPostQuantumEncryptionEditResponseValueOff: + return true + } + return false +} + type OriginPostQuantumEncryptionGetResponse struct { // Value of the zone setting. ID OriginPostQuantumEncryptionGetResponseID `json:"id,required"` @@ -120,6 +205,77 @@ func (r OriginPostQuantumEncryptionGetResponseValue) IsKnown() bool { return false } +type OriginPostQuantumEncryptionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the Origin Post Quantum Encryption Setting. + Value param.Field[OriginPostQuantumEncryptionEditParamsValue] `json:"value,required"` +} + +func (r OriginPostQuantumEncryptionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Origin Post Quantum Encryption Setting. +type OriginPostQuantumEncryptionEditParamsValue string + +const ( + OriginPostQuantumEncryptionEditParamsValuePreferred OriginPostQuantumEncryptionEditParamsValue = "preferred" + OriginPostQuantumEncryptionEditParamsValueSupported OriginPostQuantumEncryptionEditParamsValue = "supported" + OriginPostQuantumEncryptionEditParamsValueOff OriginPostQuantumEncryptionEditParamsValue = "off" +) + +func (r OriginPostQuantumEncryptionEditParamsValue) IsKnown() bool { + switch r { + case OriginPostQuantumEncryptionEditParamsValuePreferred, OriginPostQuantumEncryptionEditParamsValueSupported, OriginPostQuantumEncryptionEditParamsValueOff: + return true + } + return false +} + +type OriginPostQuantumEncryptionEditResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success OriginPostQuantumEncryptionEditResponseEnvelopeSuccess `json:"success,required"` + Result OriginPostQuantumEncryptionEditResponse `json:"result"` + JSON originPostQuantumEncryptionEditResponseEnvelopeJSON `json:"-"` +} + +// originPostQuantumEncryptionEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [OriginPostQuantumEncryptionEditResponseEnvelope] +type originPostQuantumEncryptionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OriginPostQuantumEncryptionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r originPostQuantumEncryptionEditResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type OriginPostQuantumEncryptionEditResponseEnvelopeSuccess bool + +const ( + OriginPostQuantumEncryptionEditResponseEnvelopeSuccessTrue OriginPostQuantumEncryptionEditResponseEnvelopeSuccess = true +) + +func (r OriginPostQuantumEncryptionEditResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case OriginPostQuantumEncryptionEditResponseEnvelopeSuccessTrue: + return true + } + return false +} + type OriginPostQuantumEncryptionGetParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` diff --git a/origin_post_quantum_encryption/originpostquantumencryption_test.go b/origin_post_quantum_encryption/originpostquantumencryption_test.go index 61132fc8448..0e9dc67ede6 100644 --- a/origin_post_quantum_encryption/originpostquantumencryption_test.go +++ b/origin_post_quantum_encryption/originpostquantumencryption_test.go @@ -14,6 +14,33 @@ import ( "github.com/cloudflare/cloudflare-go/v3/origin_post_quantum_encryption" ) +func TestOriginPostQuantumEncryptionEdit(t *testing.T) { + t.Skip("TODO: investigate broken test") + 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.OriginPostQuantumEncryption.Edit(context.TODO(), origin_post_quantum_encryption.OriginPostQuantumEncryptionEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(origin_post_quantum_encryption.OriginPostQuantumEncryptionEditParamsValuePreferred), + }) + 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 TestOriginPostQuantumEncryptionGet(t *testing.T) { t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" diff --git a/workers/script.go b/workers/script.go index 5c5efee1876..3a5818e6e4f 100644 --- a/workers/script.go +++ b/workers/script.go @@ -246,13 +246,16 @@ type ScriptPlacementStatus string const ( ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS" + ScriptPlacementStatusNoValidHosts ScriptPlacementStatus = "NO_VALID_HOSTS" + ScriptPlacementStatusNoValidBindings ScriptPlacementStatus = "NO_VALID_BINDINGS" ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION" ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS" + ScriptPlacementStatusInsufficientSubrequests ScriptPlacementStatus = "INSUFFICIENT_SUBREQUESTS" ) func (r ScriptPlacementStatus) IsKnown() bool { switch r { - case ScriptPlacementStatusSuccess, ScriptPlacementStatusUnsupportedApplication, ScriptPlacementStatusInsufficientInvocations: + case ScriptPlacementStatusSuccess, ScriptPlacementStatusNoValidHosts, ScriptPlacementStatusNoValidBindings, ScriptPlacementStatusUnsupportedApplication, ScriptPlacementStatusInsufficientInvocations, ScriptPlacementStatusInsufficientSubrequests: return true } return false @@ -464,13 +467,16 @@ type ScriptUpdateResponsePlacementStatus string const ( ScriptUpdateResponsePlacementStatusSuccess ScriptUpdateResponsePlacementStatus = "SUCCESS" + ScriptUpdateResponsePlacementStatusNoValidHosts ScriptUpdateResponsePlacementStatus = "NO_VALID_HOSTS" + ScriptUpdateResponsePlacementStatusNoValidBindings ScriptUpdateResponsePlacementStatus = "NO_VALID_BINDINGS" ScriptUpdateResponsePlacementStatusUnsupportedApplication ScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION" ScriptUpdateResponsePlacementStatusInsufficientInvocations ScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS" + ScriptUpdateResponsePlacementStatusInsufficientSubrequests ScriptUpdateResponsePlacementStatus = "INSUFFICIENT_SUBREQUESTS" ) func (r ScriptUpdateResponsePlacementStatus) IsKnown() bool { switch r { - case ScriptUpdateResponsePlacementStatusSuccess, ScriptUpdateResponsePlacementStatusUnsupportedApplication, ScriptUpdateResponsePlacementStatusInsufficientInvocations: + case ScriptUpdateResponsePlacementStatusSuccess, ScriptUpdateResponsePlacementStatusNoValidHosts, ScriptUpdateResponsePlacementStatusNoValidBindings, ScriptUpdateResponsePlacementStatusUnsupportedApplication, ScriptUpdateResponsePlacementStatusInsufficientInvocations, ScriptUpdateResponsePlacementStatusInsufficientSubrequests: return true } return false @@ -1414,13 +1420,16 @@ type ScriptUpdateParamsMetadataPlacementStatus string const ( ScriptUpdateParamsMetadataPlacementStatusSuccess ScriptUpdateParamsMetadataPlacementStatus = "SUCCESS" + ScriptUpdateParamsMetadataPlacementStatusNoValidHosts ScriptUpdateParamsMetadataPlacementStatus = "NO_VALID_HOSTS" + ScriptUpdateParamsMetadataPlacementStatusNoValidBindings ScriptUpdateParamsMetadataPlacementStatus = "NO_VALID_BINDINGS" ScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementStatus = "UNSUPPORTED_APPLICATION" ScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementStatus = "INSUFFICIENT_INVOCATIONS" + ScriptUpdateParamsMetadataPlacementStatusInsufficientSubrequests ScriptUpdateParamsMetadataPlacementStatus = "INSUFFICIENT_SUBREQUESTS" ) func (r ScriptUpdateParamsMetadataPlacementStatus) IsKnown() bool { switch r { - case ScriptUpdateParamsMetadataPlacementStatusSuccess, ScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication, ScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations: + case ScriptUpdateParamsMetadataPlacementStatusSuccess, ScriptUpdateParamsMetadataPlacementStatusNoValidHosts, ScriptUpdateParamsMetadataPlacementStatusNoValidBindings, ScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication, ScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations, ScriptUpdateParamsMetadataPlacementStatusInsufficientSubrequests: return true } return false diff --git a/workers_for_platforms/dispatchnamespacescript.go b/workers_for_platforms/dispatchnamespacescript.go index 29b6537b287..71e4fd68f02 100644 --- a/workers_for_platforms/dispatchnamespacescript.go +++ b/workers_for_platforms/dispatchnamespacescript.go @@ -265,13 +265,16 @@ type DispatchNamespaceScriptUpdateResponsePlacementStatus string const ( DispatchNamespaceScriptUpdateResponsePlacementStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementStatus = "SUCCESS" + DispatchNamespaceScriptUpdateResponsePlacementStatusNoValidHosts DispatchNamespaceScriptUpdateResponsePlacementStatus = "NO_VALID_HOSTS" + DispatchNamespaceScriptUpdateResponsePlacementStatusNoValidBindings DispatchNamespaceScriptUpdateResponsePlacementStatus = "NO_VALID_BINDINGS" DispatchNamespaceScriptUpdateResponsePlacementStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION" DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS" + DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientSubrequests DispatchNamespaceScriptUpdateResponsePlacementStatus = "INSUFFICIENT_SUBREQUESTS" ) func (r DispatchNamespaceScriptUpdateResponsePlacementStatus) IsKnown() bool { switch r { - case DispatchNamespaceScriptUpdateResponsePlacementStatusSuccess, DispatchNamespaceScriptUpdateResponsePlacementStatusUnsupportedApplication, DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientInvocations: + case DispatchNamespaceScriptUpdateResponsePlacementStatusSuccess, DispatchNamespaceScriptUpdateResponsePlacementStatusNoValidHosts, DispatchNamespaceScriptUpdateResponsePlacementStatusNoValidBindings, DispatchNamespaceScriptUpdateResponsePlacementStatusUnsupportedApplication, DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientInvocations, DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientSubrequests: return true } return false @@ -1216,13 +1219,16 @@ type DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus string const ( DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "SUCCESS" + DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusNoValidHosts DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "NO_VALID_HOSTS" + DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusNoValidBindings DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "NO_VALID_BINDINGS" DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "UNSUPPORTED_APPLICATION" DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "INSUFFICIENT_INVOCATIONS" + DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusInsufficientSubrequests DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus = "INSUFFICIENT_SUBREQUESTS" ) func (r DispatchNamespaceScriptUpdateParamsMetadataPlacementStatus) IsKnown() bool { switch r { - case DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusSuccess, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations: + case DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusSuccess, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusNoValidHosts, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusNoValidBindings, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusUnsupportedApplication, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusInsufficientInvocations, DispatchNamespaceScriptUpdateParamsMetadataPlacementStatusInsufficientSubrequests: return true } return false diff --git a/zero_trust/organizationdoh.go b/zero_trust/organizationdoh.go index 020d37eb7d1..a9b1661b6cf 100644 --- a/zero_trust/organizationdoh.go +++ b/zero_trust/organizationdoh.go @@ -76,16 +76,16 @@ type OrganizationDOHUpdateResponse struct { // `CF-Access-Client-ID` request header. ClientID string `json:"client_id"` CreatedAt time.Time `json:"created_at" format:"date-time"` - // The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. - // Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum - // duration for this setting is the same as the key rotation period on the account. - // Default expiration is 24h - DOHJWTDuration string `json:"doh_jwt_duration"` // The duration for how long the service token will be valid. Must be in the format // `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The // default is 1 year in hours (8760h). Duration string `json:"duration"` ExpiresAt time.Time `json:"expires_at" format:"date-time"` + // The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. + // Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum + // duration for this setting is the same as the key rotation period on the account. + // Default expiration is 24h + JWTDuration string `json:"jwt_duration"` // The name of the service token. Name string `json:"name"` UpdatedAt time.Time `json:"updated_at" format:"date-time"` @@ -95,16 +95,16 @@ type OrganizationDOHUpdateResponse struct { // organizationDOHUpdateResponseJSON contains the JSON metadata for the struct // [OrganizationDOHUpdateResponse] type organizationDOHUpdateResponseJSON struct { - ID apijson.Field - ClientID apijson.Field - CreatedAt apijson.Field - DOHJWTDuration apijson.Field - Duration apijson.Field - ExpiresAt apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + ExpiresAt apijson.Field + JWTDuration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *OrganizationDOHUpdateResponse) UnmarshalJSON(data []byte) (err error) { @@ -122,15 +122,15 @@ type OrganizationDOHGetResponse struct { // `CF-Access-Client-ID` request header. ClientID string `json:"client_id"` CreatedAt time.Time `json:"created_at" format:"date-time"` - // The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. - // Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum - // duration for this setting is the same as the key rotation period on the account. - DOHJWTDuration string `json:"doh_jwt_duration"` // The duration for how long the service token will be valid. Must be in the format // `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The // default is 1 year in hours (8760h). Duration string `json:"duration"` ExpiresAt time.Time `json:"expires_at" format:"date-time"` + // The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. + // Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum + // duration for this setting is the same as the key rotation period on the account. + JWTDuration string `json:"jwt_duration"` // The name of the service token. Name string `json:"name"` UpdatedAt time.Time `json:"updated_at" format:"date-time"` @@ -140,16 +140,16 @@ type OrganizationDOHGetResponse struct { // organizationDOHGetResponseJSON contains the JSON metadata for the struct // [OrganizationDOHGetResponse] type organizationDOHGetResponseJSON struct { - ID apijson.Field - ClientID apijson.Field - CreatedAt apijson.Field - DOHJWTDuration apijson.Field - Duration apijson.Field - ExpiresAt apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + ExpiresAt apijson.Field + JWTDuration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *OrganizationDOHGetResponse) UnmarshalJSON(data []byte) (err error) { @@ -167,7 +167,7 @@ type OrganizationDOHUpdateParams struct { // Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum // duration for this setting is the same as the key rotation period on the account. // Default expiration is 24h - DOHJWTDuration param.Field[string] `json:"doh_jwt_duration"` + JWTDuration param.Field[string] `json:"jwt_duration"` // The uuid of the service token you want to use for DoH authentication ServiceTokenID param.Field[string] `json:"service_token_id"` } diff --git a/zero_trust/organizationdoh_test.go b/zero_trust/organizationdoh_test.go index 4cc1c0e4b5b..bb8bb63a39f 100644 --- a/zero_trust/organizationdoh_test.go +++ b/zero_trust/organizationdoh_test.go @@ -29,7 +29,7 @@ func TestOrganizationDOHUpdateWithOptionalParams(t *testing.T) { ) _, err := client.ZeroTrust.Organizations.DOH.Update(context.TODO(), zero_trust.OrganizationDOHUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - DOHJWTDuration: cloudflare.F("800h"), + JWTDuration: cloudflare.F("800h"), ServiceTokenID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), }) if err != nil {